Svelte 5 Runes - How to talk to the compiler ft Rich Harris

  Рет қаралды 17,987

Prismic

Prismic

Күн бұрын

Svelte 5 introduces a new concept called Runes that basically allow you to use magical symbols that influence the Svelte compiler.
We brought Rich Harris, the creator of Svelte, to the Prismic Studio to show us how you can use runes in your next Svelte project.
🔗 Try Svelte & Prismic in a 3D Portfolio website project:
• Create a Creative Port...
🔗 Build a dark modern website with Sveltekit and GSAP
• Build an Animated Webs...
---
As a developer, you should build websites using your favorite Jamstack framework.
Prismic allows you to build website sections, that you can connect to a website builder for your client or team. They will create pages from there and you get that content back to your code through our fast API.
---
#svelte5 #runes

Пікірлер: 44
@nyashachiroro2531
@nyashachiroro2531 6 ай бұрын
The fact that the code produced by the Svelte compiler is actually somewhat readable and understandable is impressive, especially compared to what's produced when other libraries are transpiled.
@rbnzdave
@rbnzdave 6 ай бұрын
actually react maps work really well if you dont use .jsx as an extension. if you use .js, chrome at least shows the original code nicely, have found it hates me when i leave as jsx before transpiling.
@ndykhng
@ndykhng 6 ай бұрын
​@@rbnzdave OP's point is the transpiled code looks nice (the resulting .js), not just the code that you write (.jsx)
@avwie132
@avwie132 5 ай бұрын
Why would I care how the compiled code looks?
@Hugos68
@Hugos68 5 ай бұрын
@@avwie132 The compiled code reflects the simplicity of svelte 5. The compiler merely adds boilerplate, not as much magic as svelte 4. Which is great for debugging.
@dand4485
@dand4485 5 ай бұрын
@@avwie132 Asking why the transpiled code matters, guess you've never had to debug anything?
@DavidHust
@DavidHust 5 ай бұрын
Rich is a beast. He's been doing these same interviews for about a year, and he's still excited to show it off.
@b1mind
@b1mind 6 ай бұрын
Really enjoyed this deep dive into the compiler. Excited about Svelte5!!
@everythingisfine9988
@everythingisfine9988 5 ай бұрын
Upgrading Svelte 4 👉 5 and everything still works. That's such a *BIG* win for svelte. The only major technical advantage React had was seamless upgrades and Svelte just achieved that 🏆
@Ripstikerpro
@Ripstikerpro 5 ай бұрын
The ability to use classes as stores is such a nice improvement, I love it
@WebJeda
@WebJeda 6 ай бұрын
Svelte is the only framework that sparked joy for me ✨
@TrostCodes
@TrostCodes 6 ай бұрын
Svelte Summer is just so so good!
@adriablancafort
@adriablancafort 6 ай бұрын
I love svelte 5! Can't wait
@ymi_yugy3133
@ymi_yugy3133 5 ай бұрын
The svelte repl is amazing. It's my go to place whenever I need to try some web related thing
@registro_pedagogico
@registro_pedagogico 6 ай бұрын
Svelte es mi framework favorito, estoy ansioso de que salga la versión estable
@DamonMedekMusic
@DamonMedekMusic 6 ай бұрын
Wow, what a rockstar.
@dei8bit
@dei8bit 6 ай бұрын
Que hermosura svelte ♥
@justadevlog1667
@justadevlog1667 6 ай бұрын
Ok i lost my mind for second when i saw bind: in action Holly that's insane
@m_raez
@m_raez 5 ай бұрын
Since Runes are still Runtime-Reactivity, you can easily build an API to your liking using them as primitives
@DomskiPlays
@DomskiPlays 6 ай бұрын
Yoooooo lets go. I love Svelte 5 the only thing I hate is how destructuring loses reactivity which was super confusing at first
@Antonio-fo4fl
@Antonio-fo4fl 6 ай бұрын
You can use the $derived rune to preserve reactivity of destructured values. Ofc read only though
@TheStickofWar
@TheStickofWar 6 ай бұрын
​@@Antonio-fo4fl it would be strange and cause extreme problems if derived values in any framework could affect what they were derived from. Think of them as pure functions only
@Antonio-fo4fl
@Antonio-fo4fl 6 ай бұрын
@@TheStickofWar did you not see where I said the derived destructured values ofc would be read only?
@DomskiPlays
@DomskiPlays 6 ай бұрын
@@Antonio-fo4fl I know but often I want to destructure a stateful prop and bind to it and the only way to do it is with xyz.item :/
@maloxi1472
@maloxi1472 3 ай бұрын
He was simply pointing out why that had to be the case
@danielrincodev
@danielrincodev 6 ай бұрын
hipe! 🧡
@robotempire
@robotempire 3 ай бұрын
@16:32 I suppose $.source is a "source" of reactive signals, while $.proxy is proxying the array primitive which contains sources? So the thing produced by $.proxy is like a signal controller, maybe? I reckon any iterable object would be compiled down to a proxy or something like this? interesting conversation all around regardless
@robotempire
@robotempire 3 ай бұрын
@20:34 seems like maybe i wasn't too far off wrt proxies being controllers in some sense
@everythingisfine9988
@everythingisfine9988 5 ай бұрын
I use jsDocs + default function parameters (when possible) & raw-dog everything else ✌️
@figloalds
@figloalds 5 ай бұрын
11:44 yo what's this undocumented sorcery he just did there? Wow 👏 I love to have learned this
@Hugos68
@Hugos68 5 ай бұрын
Anything inside markup between {} is an expression, so any type of js, console.log included. And since that {} block depends on a reactive variable it will rerun. You should use $inspect for this though.
@2manasama
@2manasama 28 күн бұрын
it's minute 6, Rune spawn ^_^
@Animadroids
@Animadroids 6 ай бұрын
Runes Bloody Runes
@Lemmy4555
@Lemmy4555 6 ай бұрын
You don't have to use a class, you can also just write a function that returns an object where the fields are the fields of the class, and you can also expose methods that can use this.foo to access the fields of the object itself, for simple use cases it's less verbose than classes
@mixed_nuts
@mixed_nuts 6 ай бұрын
There's a reason he uses a class. Mainly for performance.
@abdel17
@abdel17 6 ай бұрын
classes in Svelte are less verbose actually class Todo { text = $state(""); done = $state(false); constructor(initial) { this.text = initial; } } function createTodo(initial) { let text = $state(initial); let done = $state(false); return { get text() { return text }, set text(v) { text = v }, get done() { return done }, set done(v) { done = v }, }; }
@Lemmy4555
@Lemmy4555 6 ай бұрын
@@abdel17 mmmh i see, yeah i assumed that classes and objects worked the same because they do in regular js, but here svelte is doing something special for classes, weird in my opinion. However you can always return the plain object and wrapt in in $state later but then: function createTest(initial) { return { text: initial, setText(v) { this.text = v } }; } let todo = $state(createTest('hello')) {todo.text} todo.setText('ola')}> clicks
@Sammi84
@Sammi84 6 ай бұрын
​​@@Lemmy4555that looks redundant and actually does less than when you just pass an object directly to &state, because it doesn't do proxying.
@Lemmy4555
@Lemmy4555 6 ай бұрын
it does proxy, i checked, looks like svelte 5 wraps into proxies everything that is not a primitive value, so function calls are wrapped into proxies. eg: function createTest(initial) { return '' } let todo = $state(createTest('test')) //becomes function createTest(initial) { return ''; } let todo = $.source($.proxy(createTest('test')));
20 Svelte Features You Missed During Advent Of Svelte
20:07
Joy of Code
Рет қаралды 12 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Svelte 5: Introducing Runes... with Rich Harris
12:35
Svelte Society
Рет қаралды 98 М.
Master The Svelte Context API
18:07
Joy of Code
Рет қаралды 10 М.
Building a 3D website with R3F - pt1 Setup
17:14
3eyes
Рет қаралды 3,9 М.
Rich Harris | Svelte 5: Beyond Components | ViteConf 2024
5:05
Svelte 5 Is Like React, But Better
19:33
Theo - t3․gg
Рет қаралды 88 М.
Why is everyone LYING?
7:56
NeetCodeIO
Рет қаралды 385 М.
Different Ways To Share State In Svelte 5
28:41
Joy of Code
Рет қаралды 15 М.
What Makes A Great Developer
27:12
ThePrimeTime
Рет қаралды 245 М.
How to OVER Engineer a Website // What is a Tech Stack?
11:20
Fireship
Рет қаралды 2,6 МЛН