4

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.

CC BY-SA 4.0

1 Answer 1

7

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.

CC BY-SA 4.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.