News for hackers. Stuff that matters.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by FireInsight on Thursday June 15, 2023 @01:49PM (#36344137)
The king of "use JS frameworks, output pure HTML" is Astro. (https://astro.build/) It's basically an SSG where you can use a number of frameworks to write your components, and shipping any JS is explicitly opt-in.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by satvikpendem on Thursday June 15, 2023 @01:55PM (#36344221)
Astro is pretty nice too, I was going to write my blog with it but I liked the instant page transitions that NextJS provides out of the box for which I couldn't find a suitable solution in Astro.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by toddmorey on Thursday June 15, 2023 @05:45PM (#36346994)
Astro is adding (optional) client-side routing. I’m excited about that.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by jen729w on Thursday June 15, 2023 @05:47PM (#36347036)
Doesn’t NextJS do that with client-side JS though?

I recently moved from Gatsby, which did that — and the transitions sure are instantaneous — to Astro, which outputs plain HTML pages. Each navigation is a request to the server. Yeah, they take a touch longer. But the response is tiny.

You could always `preload`?

Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by satvikpendem on Thursday June 15, 2023 @06:23PM (#36347504)
I tried preload, it doesn't work as well as with NextJS which, yes, uses client side JS. But critically, the pages still work without JS if one so chooses. It's progressive enhancement which Astro does not yet have.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by vegcel on Thursday June 15, 2023 @07:12PM (#36348179)
Could you explain a bit what you do like/don't like about Gatsby compared to Astro?
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by satvikpendem on Thursday June 15, 2023 @09:15PM (#36349584)
I used to use Gatsby, but the non standard plugin system as well as forcing GraphQL (I use GQL in my own projects but it's just not necessary for a blog site for example, which Gatsby markets itself as being for) put me off Gatsby and onto NextJS, especially when NextJS introduced their static site rendering features. Now with server components, there doesn't seem to be a real need to use Gatsby anymore.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by jen729w on Friday June 16, 2023 @12:09AM (#36351101)
Gatsby felt like it had grown in to a monster. Astro was a lot simpler which suits my needs and, frankly, skill.

I worry that Astro is adding too many features and trying to become Gatsby. No thanks!

Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by colesantiago on Thursday June 15, 2023 @01:57PM (#36344242)
Why Astro instead of say, Svelte?
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by FireInsight on Thursday June 15, 2023 @02:14PM (#36344459)
Astro is a metaframework that among others can use Svelte for both static and interactive components. Plain Svelte without a metaframework is not suitable for normal websites with multiple pages, but Astro is.

As for Astro vs SvelteKit, I generally prefer Astro's approach to filesystem based routing (no +page etc.), I prefer it's MPA approach to the clientside routing SvelteKit and others use OOTB, I like that it's very tailored towards content and being an SSG (content collections, MD and MDX support ootb, currently experimental automatic image optimization), and the "integrations" are a huge time-saver. Some common ones you can add with `astro add`, and many others are just a quick config edit away. I recently built a pretty performant portfolio site with Astro in a single day using DecapCMS and UnoCSS, both as integrations, all the client had to do was accept the invite from Netlify Identity and start adding content to their site!

Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by password54321 on Thursday June 15, 2023 @02:16PM (#36344488)
No advantage if you just want to use Svelte when SvelteKit does everything Astro does and more while having less dependencies.
Re:UnsuckJS: Progressively enhance HTML with lightweight Jav... by FireInsight on Thursday June 15, 2023 @02:18PM (#36344510)
Well, dependency count is not the metric on which I base my tech decisions on. After all, you could do everything Svelte does with VanillaJS.

I just prefer the DX of Astro and MPA routing instead of client-side.