Scaffolding in Eleventy

- take your time to read it

I've rebuild my website with Elventy and Tailwind. One feature that I really liked about Hugo was to scaffold new posts, so I've build my own Steiger.

All of my blogs have been static sites that are generated in a build process and then pushed to some hosting. Each post is simply a markdown page in the folder denoting it's date, so posts/2020/07/06/scaffolding-in-eleventy.md for this particular post. Each page also has metadata for the title, description, etc...

---
title: "Scaffolding in Eleventy"
description: "Scaffolding in Eleventy"
date: 2020-07-06T16:27:46.409+02:00
draft: false
tags: [Elventy, static website]
---

With these things I'm really lazy. I do not want to copy/paste, create folders, etc. Just execute scaffold posts/2020/07/06/scaffolding-in-eleventy.md and I want to have a premade template where I fill in the content.

Unfortunately it was not included in Eleventy, so I rolled my own using Chalk for colored terminal output, Commander for the CLI, Luxon for dates, times (because the vanilla dates in Javascript breaks your brain), Nunjucks for templating.

The package has reached version 0.0.2 and it autogenerates the file you want, checks if it exists and gives the current datetime to the template. Over time as I use it, I'll probably add more features.

Back