DEV Community

swyx
swyx

Posted on • Updated on • Originally published at swyx.io

Why Svelte? (The Short Version)

I'm preparing an introductory talk on Why Svelte for the March Svelte Society NYC meetup so here are my talk notes.

My slides are here.

Ryan Atkn wrote a longer version here.

Why is it called Svelte?

Attractively thin, graceful and stylish.

What is Svelte?

Svelte is a compiler, not a library - it takes your Svelte input and turns it into server rendered HTML, static CSS, and clientside JS, and it can build to WebGL, iOS, Android, and Web Components.

In a library, the code that you write is the code that runs. You have to trade off features vs code size.

With a compiler, the code that you write can compile to all sorts of formats, so your solution space gets much larger, while also being able to turn code into efficient low level equivalents. You can include features like styles, transitions, and FLIP animations without adding code size if it isn't used, or building in compile time accessibility and unused CSS checking.

Svelte in Rich's words

In 2019 Rich did a series of 3 talks that explored different viewpoints of Svelte:

  • Computer, build me an app - Svelte as a compiler that takes your component code and turns it into vanilla JavaScript, that manipulates the DOM directly. This means bundles are smaller, which means for faster download and startup times.
  • Rethinking Reactivity - React reruns too much, memoization and amortization APIs are abstraction leaks. Svelte 3 moves reactivity out of the component API (this.set()), and into the language (= and $:). Spreadsheets and Reactive Programming is approachable to more people, like Svelte is with the HTML approach.
  • The Return of Write Less, Do More - Svelte lets you write less code with better tooling support because HTML is the language of the web. Writing less lets you do more. Taken to an extreme it may let a lot more people create software and save the planet.

Benchmark Hijacks:

Basically, Svelte is fast enough. I don't really care about who is fastest.

Why I enjoy Svelte

This is a rehash of a blogpost I did

  • Batteries Included
  • The Joy of Mutability
  • $ugar $yntax
    • Two Way Binding
    • Stores
  • Good Docs
  • Simple Internals

It is still Early Days

Most of all, it is fun and small. Ever felt like you were too late on a framework or community? Now is your chance, there's very little baggage and a lot of blank space for you to color in:

Top comments (1)

Collapse
 
pavelloz profile image
Paweł Kowalski

This is also very good intro: youtube.com/watch?v=ogXETl_I0Dg