Skip to content

bodjay/svelte-library-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svelte library template

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-library

Note that you will need to have Node.js installed.

Get started

Install the dependencies...

cd svelte-library
npm install

...then start Rollup:

npm run dev

Navigate 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.

Building and running in production mode

To create an optimised version of the library:

npm run build

You 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.

Single-page app mode

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.

Deploying to the web

After finish your awesome library, yarn the follow command

npm run build

Then, from the dist folder, generated by build command, execute the follow command:

npm publish

Note: to use this library in sapper, install as devDependency. See the link.

Feel free to contribute!

About

This is a project template for Svelte libraries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published