Skip to content
Conv edited this page Jun 10, 2019 · 30 revisions

SVELTE

I'm new to Svelte. Where should I start?

We think the best way to get started is playing through the interactive Tutorial. Each step there is mainly focused on one specific aspect and is easy to follow. You'll be editing and running real Svelte components right in your browser.

Five to ten minutes should be enough to get you up and running. An hour and a half should get you through the entire tutorial.

Are there any video courses?

There are no official ones, but here are a couple of third-part ones that we know of.

Note that Udemy very frequently has discounts over 90%.

Is svelte.dev down?

It's always possible! But if you can't access any .dev sites, check out this SuperUser question and answer.

How can I get VSCode to syntax-highlight my .svelte files?

Add the following to your VSCode settings.json:

{
  "files.associations": {
    "*.svelte": "html"
  }
}

What about Typescript support?

We have no TS support yet but it's very much planned - v3 was partly about laying the foundation for it. You can track progress in #1639.

Does Svelte scale?

There will be a blog post about this eventually, but in the meantime, check out this issue.

Is there UI component library?

Not yet as far as we know. If you make one, let us know in chat so we can add it here!

How do I do testing Svelte apps?

We don't have a good answer to this yet, but it is a priority. There are a few approaches that people take when testing, but it generally involves compiling the component and mounting it to something and then performing the tests. You essentially need to create a bundle for each component you're testing (since svelte is a compiler and not a normal library) and then mount them. You can mount to a JSDOM instance, or you can use Puppeteer if you need a real browser, or you can use a tool like Cypress. There is an example of this in the Sapper starter template.

Is there a router?

You can use any router lib you want. A lot of people use page.js. There's also navaid, which is very similar. If you prefer a declarative HTML approach, there's svero and svelte-routing.

If you need hash-based routing on the client side, check out svelte-spa-router, or abstract-state-router, a mature router for business software.

For an official solution, there's nothing that's simply a routing library. There is, however, the official Sapper framework, a Next.js-style application framework built on Svelte, which includes its own filesystem-based routing.

How can I update my components written in Svelte v2?

svelte-upgrade isn't fully working for v2->v3 yet, but it's close.

Is Svelte v2 still available?

New features aren't being added to it, and bugs will probably only be fixed if they are extremely nasty or present some sort of security vulnerability.

The documentation is still available here.


SAPPER

Why isn't hot module reloading working?

Track progress in #2377.

Why is there a node_modules folder in the src folder of a Sapper project?

Before bundling your app, Sapper builds a special package for your app, which you can access by importing from @sapper/app. Putting it inside src/node_modules means that it won't get nuked when you add new dependencies, and that you can easily import from it using the Node resolution algorithm.

Clone this wiki locally
You can’t perform that action at this time.