Why I switched from Eleventy
The first version of this blog was Jekyll, since I first built it as a GitHub Pages site in 2016. I’d switched from Jekyll to Eleventy in 2020 because I couldn’t wrap my head around Ruby errors.
After taking a break from blogging, I wanted to make some updates to this site. First of all, one of the build commands gave me this error:
Some Google searching revealed it had something to do with C++ and Python. Yeah no thanks! That’s kind of preposterous, considering that all I’m really trying to do here is build some Markdown and HTML templates.
Second of all, to my dismay I found that my Eleventy starter and its CSS framework got deprecated. As in, trying to navigate to their repos on GitHub gave me 404s. You think it could never happen to you until it does. 🥲
I could have just switched to a different starter, but I was ready to move on from Eleventy anyway.
Eleventy pros (over Jekyll)
- it’s Just JavaScript™ / an npm package (no Ruby necessary)
Eleventy cons
- I don’t use Nunjucks templating language anywhere else
- it’s just similar enough to Liquid (Jekyll’s templating language) that I always confuse the syntax for the two
- I had difficulty trying to set up an alternative templating language (Vue, React, etc)
- skill transfer: I’ve never seen Eleventy mentioned in a job description
- but in November 2023 I read one that said “bonus points if you’ve worked with Astro”
I have nothing against Eleventy’s authors or community; a tool is a tool and this one’s just not my preference.
Why Astro?
I like React, but Next/Remix are too heavy for this job. And I didn’t like the idea of writing my blog as an entirely client-side JS app, for SEO reasons.
Even though I’ve mostly fallen off of dev Twitter (and Twitter itself has fallen off considerably) in the past year or so, during that time I’ve read great things there about Astro as a static site generator. After using it to rebuild this site again I’ve come to the conclusion that Astro is what I wanted Eleventy to be, and then some. Its philosophy of shipping as little JS as possible is perfect for my use case of “mostly static (Markdown), with a bit of interactivity”.
I did reinvent the wheel a bit by not using a starter/theme. But at the very least, everything that’s going on outside of Astro’s magic black box is under my control.
Astro pros
- docs are very comprehensive and dev-friendly
- config file / plugins are easier to set up
- frontend framework agnostic: I can sprinkle in interactive components written with vanilla JS, React, Svelte, or any other framework I want to try out
- default templating language (
.astro
) has a very low learning curve for me since I’ve used Svelte at work- Astro syntax is actually more JS-like than Svelte, since you can write conditional/mapped elements in
{curlies}
as opposed to#if
/#each
- Astro syntax is actually more JS-like than Svelte, since you can write conditional/mapped elements in
- it was a breeze to add view transitions
Astro cons
I don’t really have any except for these two bugs:
- I had some trouble loading a variable font with Fontsource (Astro’s recommended provider for Google Fonts) because I kept seeing a flicker before the font loaded, and Fontsource’s docs were 404ing
- when writing the hero text component on the homepage, I was getting an error saying
Astro2 is not defined
- this ended up being my fault because I’d tried referencing
Astro.props
in ascript
tag (the Svelte way) instead of in code fences---
(the Astro way)
- this ended up being my fault because I’d tried referencing
Overall, I hope this new architecture reduces friction and makes it easier for me to write here consistently.
I’m sure this post is gonna look real funny when I rebuild my blog again in a few years.