I've rebuilt my site in Astro

11ty (Eleventy) has served me well, but I wanted to try something new. Over the last week I've converted this website from 11ty to Astro.

Astro.build is front-end framework with SSG (Static Site Generator) features. Like Eleventy, you can generate static pages based on Markdown files and the likes. For me, having all my content in Sanity, it's also possible to dynamically generate static pages by fetching data through Sanity's API.

Astro vs. 11ty

Here's a few thoughts about the change, and what I like/don't like about both frameworks:

11ty

Pros

Cons

  • I found it hard to find good documentation and guides. Stephanie Eckles has a great website called 11ty.rocks which has a lot of great tips, but other than that I found the official documentation a bit "how to draw an owl".
  • No good way of creating a preview of the website in Sanity. OK, I'll admit I haven't explored it very much in depth, but if I wanted to see my website within Sanity when I write my posts and whatnot, I don't know how to accomplish that.

11ty is a great tool, and all in all easy to work with, but it's taken a lot of time for me to get to a point where I easily can troubleshoot a problem.

Astro

Pros

  • The .astro files are great! I don't like React. One reason why is actually really stupid, but when you create a component in React you have to export a function containing the markup in JSX. Astro (and Svelte) do the smart thing and figure out what part of your file is JSX and does that for you (due to the .astro and .svelte file extensions). It makes me feel like I'm writing markup first and add JS when necessary, not the other way around.
  • JSX. I'm starting to like writing JSX. One big reason is that the IntelliSense of IDEs is better at helping me with Javascript than Handlebars, Nunjucks or Liquid. Also, I can use Typescript (although you'll find many cases where I use "any" all over the place, not really helping me).
  • The documentation. Astro's docs are good. Having never used Astro it only took me a couple of days to get the hang of it, and I rebuilt my site in a week, largely due to how easy it was to read up on stuff.
  • Astro is possible to integrate with Sanity for Live Editing and preview.

Cons

I don't really have any cons at the moment. I like it a lot. I'm not using any "Astro magic" as of yet, like Astro Islands. I'm only generating collections and pages based on data from Sanity, and for that purpose Astro is great!


Moving forward

I'll definately going to use Astro going forward. Perhaps I'll write a guide on how I converted my site from 11ty to Astro, too.

My next step is to add a preview inside Sanity.