Live data from Hacker News

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

svelte.technology

21–30 of 236 posts

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

#21

Precompilation is cool, but please don't imply that your framework is the first to do it. Precompiled templates significantly predate HTML, they were common in the mainframe world. In the HTML world there are tons of other templaters that allow precompilation. Handlebars is a common one: http://handlebarsjs.com/precompilation.html This is a huge part of Javascript fatigue for me. I love the fact that we're recycling…

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.

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

#23

Precompilation is cool, but please don't imply that your framework is the first to do it. Precompiled templates significantly predate HTML, they were common in the mainframe world. In the HTML world there are tons of other templaters that allow precompilation. Handlebars is a common one: http://handlebarsjs.com/precompilation.html This is a huge part of Javascript fatigue for me. I love the fact that we're recycling…

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…

"Please open this page in a larger screen!"

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

#24

This looks nice: a Javascript framework for expressing _concepts_ that compiles down to vanilla JS. It looks like it ships a lot less code to the user. From the project's first [blog post]( https://svelte.technology/blog/frameworks-without-the-framew... ): > The Svelte implementation of TodoMVC weighs 3.6kb zipped. For comparison, React plus ReactDOM without any app code weighs about 45kb zipped. It takes about 10x a…

I didn't study the thing, but the first question that comes to my mind is: if each component is rendered as a self contained piece of vanilla js, isn't the size of an app with lots of components going to increase much faster than with the library approach? A complete library by itself can be pretty big, but it stays the same size no matter how many components you add.

I wondered that as well at first but then I realised that it probably doesn't have much shared code as it will be using the DOM directly and that is the shared dependency

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

#25

This looks nice: a Javascript framework for expressing _concepts_ that compiles down to vanilla JS. It looks like it ships a lot less code to the user. From the project's first [blog post]( https://svelte.technology/blog/frameworks-without-the-framew... ): > The Svelte implementation of TodoMVC weighs 3.6kb zipped. For comparison, React plus ReactDOM without any app code weighs about 45kb zipped. It takes about 10x a…

React is probably a bad example, because there are API compatible implementations of React, that are 10x smaller. [0]

The Preact TodoMVC version is ~2x bigger than this example, but it states nowhere how this stuff scales with more components.

[0] https://preactjs.com/

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

#27
post #16

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…

Yes. I have the feeling most programmers are just lazy, that's why they use 2WB. And I can't blame them. Redux is much more boilerplate than MobX, for example.

Trying to avoid boilerplate is in my experience not about laziness - especially when you consider the extreme lengths a lot of developers will go to to eliminate duplication and boilerplate from their codebases. Copying a Redux reducer that implements a standard set of CRUD actions is lazier in my mind than trying to abstract common patterns away.

For me at least, the reason boilerplate bothers me so much is that it impacts the readability of my code. Ideally, I'd like my codebase to express the business requirements of my solution as succinctly as possible - every line of boilerplate code I need to include to express yet again how to make an AJAX call, or update a piece of state, is a distraction from what I'm actually trying to accomplish with the application.

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

#28
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

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.

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

#29
post #16

Earlier quoted context omitted.

Yes. I have the feeling most programmers are just lazy, that's why they use 2WB. And I can't blame them. Redux is much more boilerplate than MobX, for example.

Trying to avoid boilerplate is in my experience not about laziness - especially when you consider the extreme lengths a lot of developers will go to to eliminate duplication and boilerplate from their codebases. Copying a Redux reducer that implements a standard set of CRUD actions is lazier in my mind than trying to abstract common patterns away. For me at least, the reason boilerplate bothers me so much is that it…

"the reason boilerplate bothers me so much is that it impacts the readability of my code"

But if you hide boilerplate you not really improve readability. Not seeing what is really happening just creates the illusion of readability.

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

#30

Precompilation is cool, but please don't imply that your framework is the first to do it. Precompiled templates significantly predate HTML, they were common in the mainframe world. In the HTML world there are tons of other templaters that allow precompilation. Handlebars is a common one: http://handlebarsjs.com/precompilation.html This is a huge part of Javascript fatigue for me. I love the fact that we're recycling…

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.
Post reply on HN