Live data from Hacker News

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

svelte.technology

41–50 of 236 posts

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

#41
post #34

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…

Redux fixes two way binding by forcing the developer to emulate it using such a convoluted mechanism that there's no way to see that it's still broken; great job, FB rockstars!

If u don't like it you don't have to use it. And redux is nothing like that. It reduces a tonne of bugs among a lot of not so smart developers or beginners.

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

#43

https://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

#44
post #32

Isn't the problem of including only the code the component actually needs already solved with dead code elimination? So the framework authors can include new features but as long as your component doesn't use them the code for those feature does not end up in the final bundle you serve to the user. I sure am missing something here because the author of Svelte is actually also the author of rollup.js [1] which does ex…

Unfortunately, UI frameworks are extremely hard to modularize in a way that makes them amenable to tree-shaking. So you're left with the alternative – cobbling together your own pseudo-framework out of 'small modules', which loses all the ergonomic advantages of a good framework. As you might imagine, I've been thinking about this problem for a long time :)

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

#45

Earlier quoted context omitted.

React also uses curly braces for interpolation, not that different.

I would imagine that he meant the control-structure stuff like {#if}, rather than pure JS.

Yeah I interpreted his comment to be about syntax. OTOH React (JSX) lacks these control structures inline in the templates, it has to be done in separate steps, not a clear win for all situations.

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

#46
post #18

The 'Mustaches' bit killed it for me, but up until then I was enjoying the simplicity of the API. I like React (and React-like implementations) because of being able to use JS to build up a view

We should do a better job of clarifying: this isn't Mustache-the-language, it's just using {{ and }} as delimiters. The syntax is simpler than Mustache, and allows you to use any inline JavaScript expression, which will become fully reactive.

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

#47

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…

Tried to click the link, but the REPL is apparently so advanced that it won't even display the source code in Firefox.

The Svelte compiler uses some ES2015 features (for...of, etc) that aren't currently supported in all browsers. It's designed primarily for use in Node.

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

#48
post #32

Isn't the problem of including only the code the component actually needs already solved with dead code elimination? So the framework authors can include new features but as long as your component doesn't use them the code for those feature does not end up in the final bundle you serve to the user. I sure am missing something here because the author of Svelte is actually also the author of rollup.js [1] which does ex…

As far as I understand, ReactJS is a tightly weaved 40kB chunk of code which will be delivered to the browser no matter how ferociously you shake the tree.

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

#49
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 if you like scoped CSS, since it's already established and it's a good project.

I wonder if these ideas can be somehow applied to React, doing precompiling on React components, so that one can continue taking advantage of all freely available React components out there, and keep using Redux.

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

#50

https://svelte.technology/guide For how it actually looks. Interestingly, it shares most similarities to vue. I guess vue is winning mindshare.

> # Getting started

> Normally, this is the part where the instructions would tell you to add a tag to your page or install something from npm. But because Svelte runs at build time, it works a little bit differently.

> First, install the CLI:

> npm install -g svelte-cli

They might want to change their opening

Post reply on HN