Both compile templates to DOM manipulation code.
Svelte – A UI framework that compiles into tiny standalone JavaScript modules
231–236 of 236 posts
Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules
#232Earlier quoted context omitted.
My understanding is that there are two issues with two-way binding that are structural, and will be difficult to fix no matter how you approach it. First is that if you look at the system as a graph of updates, automatically closing all cycles between variable update and widget means that any additional two-way binding links you add become a cycle, which makes it difficult to implement, model, and debug. If the frame…
"...you also really ought to make sure the transforms are able to be roundtripped without data loss, ..." In my experience this happens inevitably; either you code it right the first time or end users discover it and it comes back as an issue that gets fixed later. There is little math involved in my experience and it's pretty hard to miss this kind of issue unless you're a complete cowboy coder or have never seen it…
You may have bodged together the relevant concepts by experience. That works perfectly fine. But there is a faster way to learn and teach it... if you can get people past the idea that there's some sort of virtue in bragging (for lack of a better word) about how math has nothing to do with programming and how little they know about the mathematics involved in programming. It's all way easier if you start with the concept of an isomorphism and learn how to compose them from the beginning, rather than having to rewrite the same concepts in your code over and over again without realizing it.
Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules
#233Earlier quoted context omitted.
I agree that it's become feasible, but even for relatively 'light' scripting my experience is that already very soon something like jQuery becomes worth using despite the increase in payload size. For example, I'm currently working on a project with mostly plain js, and I've already had to spend quite a bit of time adding code to make relatively basic things work across browsers (including mobile). Even though it's m…
"The worst part is that if I'd be allowed to lazy load some of the images and make a few small other optimizations, I would've shaved off enough Kb's to load multiple version of jQuery..." We really need to stop comparing the size of JS and images. Images do not block the app while JS often block it in many ways: download, parsing, slow executing at first (JIT), GC pauses. It's truly apples and oranges.
Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules
#234https://svelte.technology/guide For how it actually looks. Interestingly, it shares most similarities to vue. I guess vue is winning mindshare.
It's based heavily on Ractive ( http://ractivejs.org ), which Vue is very similar to.
Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules
#235Earlier quoted context omitted.
I agree. Ractive is very cool, and with a little luck could have been the hotness that vue.js has developed into.
Yeah, Ractive and Vue felt like very similar style frameworks, though Ractive's SVG support is awesome. Shame it isn't more popular.
Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules
#236TodoMVC is a useless benchmark for the problem that this claims to be addressing. The limits we're hitting with our applications now are with BIG applications, with many routes, many views, and lots of client side logic. We're talking hundreds of files (in some cases, thousands). Of course a framework, with it's fixed overhead, is going have a bigger payload for a tiny demo app like TodoMVC, than something like this…
I had done some back-of-envelope calculations[1] when I saw it on Reddit My conclusion was that it seemed like the file size would grow fairly quickly [1]( https://www.reddit.com/r/javascript/comments/5fcwhz/svelte_t... )
When adding the "Edit User" feature:
Svelte's unminified size grew 1.39x. Its min+gzip grew 1.2x. Preact's unminified size grew 1.06x. Its min+gzip grew 1.05x.
The final tally for an almost line-for-line equivalent app in both:
Preact:
- Minified: 15.8KB
- Min+GZ: 6.2KB
Svelte:
- Minified: 23KB
- Min+GZ: 4.8KB
So for a trivially small app, when minified and gzipped, Svelte does produce very compact results. But its growth rate (1.2x) vs preacts (1.05x) indicates to me that it would probably outgrow preact on a normal-sized app.
It would take a long time for it to outgrow the typical React or Angular stack, though.
[Edit: grammar]