Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bodjay/svelte-library-template
This is a project template for Svelte libraries.
https://github.com/bodjay/svelte-library-template
hacktoberfest
Last synced: about 1 month ago
JSON representation
This is a project template for Svelte libraries.
- Host: GitHub
- URL: https://github.com/bodjay/svelte-library-template
- Owner: bodjay
- Created: 2020-02-02T17:15:04.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-01T01:27:29.000Z (about 4 years ago)
- Last Synced: 2024-10-28T16:23:23.695Z (about 2 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-svelte - svelte-library-template - Template para criação de bibliotecas para Svelte. (Bibliotecas / Comunidade Global)
README
# svelte library template
This is a project template for [Svelte](https://svelte.dev) libraries. It lives at https://github.com/henriquecaraujo/svelte-library-template.
To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit):
```bash
npx degit henriquecaraujo/svelte-library-template svelte-library
cd svelte-library
```_Note that you will need to have [Node.js](https://nodejs.org) installed._
## Get started
Install the dependencies...
```bash
cd svelte-library
npm install
```...then start [Rollup](https://rollupjs.org):
```bash
npm run dev
```Navigate to [localhost:5000](http://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:
```bash
npm run build
```You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com).
## 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
### On [NPMjs](https://www.npmjs.com/)
After finish your awesome library, yarn the follow command
```bash
npm run build
```Then, from the `dist` folder, generated by build command, execute the follow command:
```bash
npm publish
```Note: to use this library in sapper, install as devDependency. See the [link](https://github.com/sveltejs/sapper-template#using-external-components).
Feel free to contribute!