Live data from Hacker News

Svelte – A UI framework that compiles into tiny standalone JavaScript modules

svelte.technology

91–100 of 236 posts

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#92

Earlier quoted context omitted.

Handlebars templates have a runtime dependency (even when precompiled). Svelte does not. Also, a precompiled Handlebars template is just a function for outputting an HTML string (with a runtime dependency). By comparison, the compiled Svelte output is a dependency-free JavaScript module for a dynamic view, which knows how (and when) to granularly update the browser DOM in response to state changes. It's unprecedented…

Svelte has a runtime dependency too, it's just bundled into the output. Everytime I've used handlebars I've bundled the runtime into my final application file. But I do it myself so it only gets bundled once rather than N times like it would be for svelte.

See the `update` method in the output of the Hello World example:

    update () {
        text1.data = root.name
    }
This is the entire DOM manipulation code for this component.

There is no runtime library. The trick here is that the generated code is aware of exactly what DOM updates are needed. Instead of a large, general-purpose reconciliator like React's, you have specialized code for changing the DOM, generated from your templates.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#93

Love it. I think the most discussion-worthy quote I found in the docs is this: > It's currently fashionable to avoid two-way binding on the grounds that it creates all sorts of hard-to-debug problems and slows your application down, and that a one-way top-down data flow is 'easier to reason about'. This is in fact high grade nonsense. It's true that two-way binding done badly has all sorts of issues, and that very la…

Hard to say when his only argument is "is in fact high grade nonsense". He's missing the big picture though: performance matters but not completely, it's not two way binding that makes two way binding bad, its developers using two way binding that makes it bad.

I also think it's ignorant to say it's fashionable to avoid two way binding, I've seen teams greatly benefit from avoiding it, teams with less experienced devs and devs who I've previously seen write terrible code. Maybe now two way binding would be easier for them, though I don't know; I'm unlikely to suggest they 180 on tech that has made them much more successful.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#96
Love the ideas.

I think now the community has settled on the Component based development, especially with JSX templates.

What we need are multiple react-kernels implementations. I see React community providing component API specs. Similar to Linux distros, we should have API compatible implementations, where application code can run on multiple kernels without any changes. We are now seeing multiple react-shim layer implementation - Preact [0], Inferno [1].

[0] https://preactjs.com

[1] https://github.com/trueadm/inferno

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#97

I love the ideas. The only other thing I like is CSS scoping, though. I think that CSS scoping is a problem in React, and current ideas on how to implement that in React are absolutely horrible IMHO. Two-way binding is a step back I think, I don't love the name (lots of people will judge a new technology by its name), and the thought of introducing yet another framework is a nightmare. I'd personally go with Polymer…

> Two-way binding is a step back I think You don't have to use it – its effects are restricted to the subtree where you've explicitly opted in to it. I've personally found it to be a huge timesaver, and would never go back to a world where I didn't have the option of using it. But you're in no way forced into it. > I wonder if these ideas can be somehow applied to React A lot of people have wondered that, including m…

Got it. I've been reading the guide, it looks good.

You did an awesome job.

I'm really scared about trying out yet another framework since I've tried pretty much all of them before settling on React, (and I guess a lot of people will be, too, since there's a new one every couple of months) but I'll try this weekend.

Thanks!

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#98
post #55

> It's basically as fast as vanilla JS, which makes sense because it is vanilla JS – just vanilla JS that you didn't have to write. What kind of logic are they using here? Isn't any javascript just vanilla JS?

Vanilla JS has long been used to refer to a lower-level JavaScript; ie not using any abstractions. Vanilla JS was often used to compare to jQuery. Of course jQuery is JavaScript.

Re: Svelte – A UI framework that compiles into tiny standalone JavaScript modules

#100
I can not keep up with all the new X flavored js frameworks, where X is [React, Angular, Vue, Mithril, Redux, Mobx,...]. This is exactly why I chose Clojurescript for my pet stuff and with hopes, that I will be able to use it for making money too. Learning curve can be steep for someone not used to functional way and/or lisp, but at the end you get a very mature, simpler and consistent language with great tooling. Figwheel workflow is just awesome. Well worth the time.
Post reply on HN