Day 2: Rebuilding this site with zero JavaScript
This site used to be a React single-page app. It's now a single Node script that turns a folder of Markdown files into static HTML, with CSS inlined into every page and no client-side JavaScript. Code blocks like the one below are highlighted at build time.
for (const file of fs.readdirSync('web/content/notes')) {
const { data, body } = parse(read(file));
page(`/notes/${slug(file)}/`, { title: data.title, body: md(body) });
}
Adding a note, essay or lab entry is now one Markdown file. Pages weigh roughly 10 to 30 KB.
What I learned: most of a website's weight is decisions nobody made on purpose.