You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
4
+
5
+
Read more about creating a library [in the docs](https://kit.svelte.dev/docs/packaging).
6
+
7
+
## Creating a project
8
+
9
+
If you're seeing this, you've probably already done this step. Congrats!
10
+
11
+
```bash
12
+
# create a new project in the current directory
13
+
npm create svelte@latest
14
+
15
+
# create a new project in my-app
16
+
npm create svelte@latest my-app
17
+
```
18
+
19
+
## Developing
20
+
21
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22
+
23
+
```bash
24
+
npm run dev
25
+
26
+
# or start the server and open the app in a new browser tab
27
+
npm run dev -- --open
28
+
```
29
+
30
+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
+
32
+
## Building
33
+
34
+
To build your library:
35
+
36
+
```bash
37
+
npm run package
38
+
```
39
+
40
+
To create a production version of your showcase app:
41
+
42
+
```bash
43
+
npm run build
44
+
```
45
+
46
+
You can preview the production build with `npm run preview`.
47
+
48
+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
49
+
50
+
## Publishing
51
+
52
+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53
+
54
+
To publish your library to [npm](https://www.npmjs.com):
0 commit comments