Live data from Hacker News

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

svelte.technology

221–230 of 236 posts

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

#222
post #126

Earlier quoted context omitted.

true, but when there is something unexpected about how the AJAX request or the HTTP server are working then debugging is going to be harder because of the abstraction.

Is it really? If there is an error it's either the abstraction or the concrete usage it stems from.

I guess I agree with that; I was thinking specifically in framework defined abstraction / usage.

And if the framework has abstracted away something that you end up needing to understand - well bad framework or bad usage I guess, but still difficult to figure out what's going on.

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

#223
post #127

> You can't write serious applications in vanilla JavaScript without hitting a complexity wall. This somewhat annoys me. You can definitely do it. Sure, it's easier, more comfortable, safer and quicker to use something like React. But you can still do some modularization that scales reasonably well without it. I've been working on an app and spent a lot of time looking into frameworks to handle its complexity but end…

I agree. Ten years ago, writing application in vanilla JS was hard because of the browser incompatibilities. Today, browser vendors really do an effort to avoid such issues. Furthermore, today the DOM API is very well documented and, over time, I find it getting easier to learn and use.

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 much less work than it used to be, it's still extra time and code that others will now also have to understand. And who knows what other browser issues linger or will pop up as more features are added!

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...

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

#224
post #173

Earlier quoted context omitted.

FWIW Rich Harris' other stuff is pretty solid: Ractive, Rollup, Bublé.

I was very shrug-y about this new non-framework until you pointed out it was a Rich Harris project. Definitely interested now...

Interessting, it all depends on who create a project, not what the project does.

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

#225

Earlier quoted context omitted.

Haven't studied the SvelteJS documentation but as far as I can reason there is nothing in their idea that prevents them from shielding the DOM behind a lightweight, virtual DOM, ReactJS style. In fact, I'd be slightly disappointed if they don't shield the DOM somehow. It's the #1 bottleneck, after all.

The virtual DOM isn't a replacement for the DOM, it's just a string diffing algorithm. It is only needed because of React's "render everywhere" approach, which is a tradeoff sacrificing efficiency for simplicity. If you don't re-render the entire page any time the model changes, you don't need a virtual DOM.

I'd say your mostly right with the one caveat that a virtual DOM also helps out with batching changes to the DOM, but I suppose there are other ways to make that happen.

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

#226

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…

I wish the React ecosystem would settle on something like Vue's approach to CSS-within-the-system. It's one of my biggest pain points at the moment.

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

#227
post #223
post #127

Earlier quoted context omitted.

I agree. Ten years ago, writing application in vanilla JS was hard because of the browser incompatibilities. Today, browser vendors really do an effort to avoid such issues. Furthermore, today the DOM API is very well documented and, over time, I find it getting easier to learn and use.

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

#228

Earlier quoted context omitted.

Yep, happily using css modules too. The only tiny issue left with that approach is that you still can't share code (for instance, colors) between JS & CSS. but overall, I think it's the best compromise today.

Look at css-module-values [0]. It's not perfect, but it lets you share values between JS and CSS. All values in the file are visible on the imported module. [0] https://github.com/css-modules/postcss-modules-values

Thanks, looks handy!

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

#229
post #187

Earlier quoted context omitted.

Good point. I tested the demos and found the output (compiled down to ES5 and minified) is around 2-3KB for the minimal demos, and 9KB for the complex SVG clock demo. The equivalent JSX output for that clock demo is about 1KB. So yes, I would guess that apps with many components would end up bigger (in total JS bundle size) than equivalent React apps. Possible counterarguments: - Bundling and gzipping several Svelte…

Storing state in Dom and reading from it could be dangerous. It's very easy to force layouts when you don't need. Frameworks like react and preact essentially do this. Abstract updating the view in a performant manner. Preact is 3kb. Magnitudes smaller than React.

I don't think it stores state on the DOM and reads from it. Pretty sure it just stores state in an object, and it updates the DOM granularly when that state changes. (That said, I did notice a bit of DOM traversal (node.parentNode...), which doesn't count as reading state from the DOM, but does rely on the structure of the DOM not having been altered by someone else since the last render – not sure why it needs to do this.)

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

#230
post #173

Earlier quoted context omitted.

FWIW Rich Harris' other stuff is pretty solid: Ractive, Rollup, Bublé.

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