Reputation: 53
When installing a SvelteKit app, you get the following options:
Which Svelte app template?
│ ○ SvelteKit demo app (A demo app showcasing some of the features of SvelteKit - play a word guessing game that works without JavaScript!)
│ ● Skeleton project (Barebones scaffolding for your new SvelteKit app)
│ ○ Library project (Barebones scaffolding for your new Svelte library)
The first one is an example, and the next two is barebones scaffolding. I don't understand the difference between the two scaffolding options. In what cases should you choose the one over the other?
I would guess SvelteKit app is the most common option, but what is a Svelte Library?
I was not able to google the answere, but it seems like a simple question that a noob like me just dont understand.
Upvotes: 5
Views: 3079
Reputation: 184286
The library option is for creating standalone components that are supposed to be distributed (e.g. as an NPM package) and used in other applications. It is not for building an application itself (though you can still have an application alongside the components for demoing or testing them).
Differences include what packages are installed and what scripts and settings are defined by default.
The library project will e.g. install @sveltejs/package
and add a package
NPM script which preprocesses the components and outputs them to a dist
directory. The package.json
will also already contain various entries like exports
, files
, svelte
and types
that set dist
up for publication and import by a consuming package.
Upvotes: 7