For the newsletter last week I jotted down some quick thoughts about Astro—it’s a static site generator that lets you build with React/Vue/Svelte components but then it produces plain ol’ HTML and CSS:
I guess that’s what’s so exciting to me: the philosophy behind Astro, more so than just what it is today.
It’s a hopeful vision of a future web where we’re not limited by past technical decisions and our users aren’t harmed by our neato developer experience.
Astro looks great for performance, accessibility, and for us as developers. So I’m sat at my desk now thinking of what I could build with this thing. It’s dang exciting! Why? There’s a few reasons.
Let’s say you want to use a fancy React toast component but you don’t want to be bogged down with everything else when it comes to React. Well, with Astro you can do just that. Install the npm package, import the component, and away you go.
I believe you can even mix and match components across frameworks, which is magic. But this is also good for the long run since perhaps your team made a mistake and now wants to introduce components from a different framework. With Astro you can slowly remove those old ones without having to do a complete re-haul of your app.
Another reason to love Astro is the new file format
.astro. It’s a heavenly combination of lots of different web technologies. Take a look at this example where Chris fetches data, imports a component, and then builds a whole mini-site with it. Isn’t that file just a pleasure to read? You start with imports at the top, but then you have a style tag for your CSS (where CSS Modules are supported out of the box), then you have the HTML that gets rendered beneath. Simple. Direct. No faffing about. And I’m sure you can have complex
.astro components, but that’ll be only when that complexity is necessary.
That last point is the most important thing to me that I missed in the newsletter: all these features sure are nice but there’s a bigger story here about frameworks and our relationship with them.
I think of this tweet by Ben a lot when it comes to the modern web:
In January I spent about 3 hours trying to convert my personal website to @gatsbyjs.
Then I asked myself “what the hell am I doing”, uploaded an index.html file and called it a day.
And that’s the point I’m getting to with this rant: when you pick a framework today that complexity is overwhelming and, for a lot of cases, pretty dang unnecessary.
The way I’m starting to think about it is this: if React is a giant fortress that can walk around the landscape on enormous mechanical legs, then Astro is a bicycle. Do you need rocket boosters? Add ‘em! Do you need a bedroom on your bicycle? That’s great—go do that. But you have to opt-in to all that complexity.
And that’s why I’m in love with this way of building websites, because software should only be as complex as it needs to be.
No more, no less.
Behold! My newsletter—sent infrequently—about new things that I’m working on. Every so often it’ll contain notes about web design and publishing things that I’m interested in, too.