ALL WRITINGCAJS / ENGINEERING NOTES

I just changed my tech stack…

I moved from Eleventy to Astro to make this blog easier to look after.

START READING
BY CAMERON STEPHEN3 MIN READASTRO / BLOGGING / WEB PERFORMANCE
  • Why I looked again

    Small changes to the blog were taking longer than I wanted.

  • Why Astro fit

    I could see which code each page used and keep writing in Markdown.

  • What I measured

    The homepage and the article I tested both loaded fewer scripts and stylesheets.

There’s always something new and shiny to try as a developer. Give me a new framework and a spare evening and I can talk myself into rebuilding a perfectly good website.

This time I wanted to spend more time writing here. Astro was already well established when I tried it on an existing post.

Why I bothered

Eleventy had served me well. As the site grew, small changes started taking longer than I liked. Changing the date format on an article card could send me through a Nunjucks template, an include and the build config.

Once I’d found the right line, I still had to work out where else it was used. Did the homepage use the same date format? I’d have the same questions about rules in the shared stylesheet, especially once I checked the site on my phone.

Back to writing

I did think about adding a CMS. A browser editor and a media library sounded handy. I’m the only one writing here, so I can set things up around how I like to work. For me, the quickest way to start is to open a Markdown file and type. I can leave it half finished and come back to it later, with the history in Git.

For this blog, Markdown means one less tool to maintain and one less login to look after. Astro turns the Markdown into HTML when I build the site, just as Eleventy did.

The homepage and Writing page both import the date formatter now, so I can see what shares it before I change it. I also gave the Astro content collection a schema, so the build points out a missing description while I’m still fiddling with the opening paragraph.

Less to download

I found that articles were loading the homepage terminal’s code and running a background animation that their styles hid. The terminal code now loads only when there’s a terminal on the page. I removed the hidden animation and split the CSS into shared and page-specific files. Astro bundles the scripts and its Fonts API lets me serve the fonts locally. I could have made similar asset changes in Eleventy too.

I rebuilt the last Eleventy version and the Astro version with the asset changes in place. I opened the homepage and the same Kubernetes article in fresh Chromium sessions with external requests blocked, then gzipped the local scripts and stylesheets using the same settings for both builds.

Local requests and estimated gzipped sizes
Page and assetEleventyAstro
Homepage JavaScript14.5 kB
13 requests
10.8 kB
6 requests, 25% smaller
Homepage CSS19.6 kB
4 requests
9.9 kB
2 requests, 49% smaller
Article JavaScript13.3 kB
12 requests
6.5 kB
4 requests, 51% smaller
Article CSS18.2 kB
4 requests
8.9 kB
2 requests, 51% smaller

The size estimates cover JavaScript and CSS. I left out fonts and HTML, and I didn’t measure network transfer or how quickly the pages loaded for visitors.

When I’d review the stack

When ordinary changes start taking longer, I’d pick one I make often, like editing the article cards, and trace what’s involved. Sometimes a bit of tidying up is enough.

If another stack looks like a good fit, I’d try it on a real page and see how it feels to edit, what it sends to the browser and how I’d deploy it. For now, I’d quite like to get a few more posts out.

THE CONVERSATION CONTINUES

Let's connect.

Have a thought on this article, or an engineering challenge on your mind? I'd be glad to hear from you.

CONTINUE THE CONVERSATIONLinkedIn.

KEEP EXPLORING / CAJS

Think.
Build.

Practical writing on backend systems, platform design and the decisions that make software easier to operate.