Hacker News new | ask | show | jobs
by demetris 338 days ago
> I've never used Astro so forgive my ignorance, but isn't that just creating a .html file, a .css file and then optionally provide a .js file? What does Astro give you in this case? You'd get the same experience with a directory of files + Notepad basically. It's also even more optimized for speed, since there is no overhead/bloat at all, including at dev-time, just pure files, sent over HTTP.

Astro is super for completely static stuff too. Sometimes static stuff can be complex and there a modern framework like Astro shines.

I will share a couple of files to explain.

The site is almost completely static. It serves minimal JS for:

(1) Prefetching (you can block that and nothing will break)

(2) Mobile menu (you cannot make an accessible mobile menu without JS)

The site is for the docs and demos of a JS library. I want many demos on it, to be able to see what patterns the lib can handle and where things break down. I want to be able to add/remove demos quickly to try ideas. Straight HTML written in index.html files would not allow me to do that (but it is fine for the site where I have my CV, so I just use that there).

This is the Astro component I made that makes it super easy for me to try whatever idea I come up with:

https://github.com/demetris/omni-carousel/blob/main/site/com...

Here is one page with demos that use the component:

https://github.com/demetris/omni-carousel/blob/main/site/pag...

Basically, without a setup like this, I would publish the site with 3 or 4 demos, and I would maybe add 1 or 2 more after a few months.

Cheers!

1 comments

So Astro is basically a (what we used to call) "static site generator" in that case? Something that existed for decades, and is basically just "compiling" templates, which could be in various syntaxes and languages, but in this case it's for JavaScript specifically. I guess the "what's old is new" point continues to stand tall :)

Again I'm failing to see exactly what Astro is "innovating" (as you and others claim they're doing). It's nothing wrong with taking a workflow and making it really stable/solid, or making it really fast, or similar. But for the claim to be "innovative" to be true, they actually have to do something new, or at least put together stuff in a new way :)

I am not saying Astro is innovative and I don’t think I implied that in my reply. I don’t view Astro as innovative and I don’t understand people who view it like that because of, say, its islands. (We knew about islands before Astro.)

As you said, in the example I shared Astro is an SSG. It happens to use server-side JS but this is is irrelevant.

But it is more than that. Astro is an SSG and it is also a *very well made* SSG.

I have used all the usual suspects: Ruby ones, Go ones, Python ones, JS ones. The closest I came to having fun was 11ty, but 11ty is a bit too chaotic for me. Astro is the one that clicked. And the one that was fun to use right from day 1.

I am not a JavaScript person, mind you. JavaScript is not my strongest FE skill. The JS conventions, tricks, and syntaxes of modern FE frameworks, even less so.

So Astro did not click for me because of that. It clicked because of how well it is made and because of how fun it is to use.

Oh! It does this!

Oh! It does that!

Oh! It gives you type safety for your Markdown meta! (What?!)

Oh! It gives you out of the box this optimization I was putting together manually! You just have to say thisOptim: true in the configuration file!

Astro is a very well made tool that improves continually and that aligns with my vision of the platform and of how we should make stuff for the platform.