News for hackers. Stuff that matters.
Re:Astro: Ship Less JavaScript by cout on Wednesday June 09, 2021 @05:33AM (#27445990)
After reading the front page, I'm a little confused. How do you go from "compose your website using UI components from your favorite JavaScript web framework" to "a fully static website with all JavaScript removed from the final page" without losing functionality provided by those components? What's the purpose of using components without JavaScript?
Re:Astro: Ship Less JavaScript by ratorx on Wednesday June 09, 2021 @05:44AM (#27446054)
I don’t use this, but I do something similar for my personal blog.

JSX (and components) is possibly the nicest templating language I’ve ever used. The problem with almost all others is that they are based on strings, so you lose type-safety (and more importantly completions) for the template parameters.

However, the current ecosystem makes it really hard to use JSX for just templating. There are libraries that do exactly that, but you end up wanting compatibility with React, because there are a ton of pre-made components that basically output only HTML (for my use case, react-fontawesome), which you miss out on by using a different library.

Re:Astro: Ship Less JavaScript by gnrlst on Wednesday June 09, 2021 @08:18AM (#27447031)
I'm sorry, but how is JSX a good templating language? I much prefer Svelte's approach where you have native HTML and script/css tags within which lives native (scoped) code.
Re:Astro: Ship Less JavaScript by ratorx on Sunday June 13, 2021 @07:37AM (#27491699)
Svelte being good doesn’t stop JSX from also being good.

I haven’t used Svelte (but I’ve given it a brief look), so some of these might be wrong.

Scoped CSS is nice but not a necessity by any means (I use Tailwind). Svelte is very restrictive, as it basically forces 1 component per file. Svelte also introduces new syntax to to handle conditional HTML and iterated HTML, which I personally don’t like. With JSX, everything is just Typescript. I’m a bit torn on slots, but I think I prefer JSX’s everything is a prop approach.