This is a project template for Svelte libraries. It lives at https://github.com/henriquecaraujo/svelte-library-template.
To create a new project based on this template using degit:
npx degit henriquecaraujo/svelte-library-template svelte-library
cd svelte-libraryNote that you will need to have Node.js installed.
Install the dependencies...
cd svelte-library
npm install...then start Rollup:
npm run devNavigate to localhost:5000. You should see your library running on a example application. Edit a component file in src, save it, and reload the page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv commands in package.json to include the option --host 0.0.0.0.
To create an optimised version of the library:
npm run buildYou can run the newly built app with npm run start. This uses sirv, which is included in your package.json's dependencies so that the app will work when you deploy to platforms like Heroku.
By default, sirv will only respond to requests that match files in public. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.
On NPMjs
After finish your awesome library, yarn the follow command
npm run buildThen, from the dist folder, generated by build command, execute the follow command:
npm publishNote: to use this library in sapper, install as devDependency. See the link.
Feel free to contribute!