This page on GitHub This page on GitHub

Rewriting the tech stack

Fri, 18 Sep 2020
submit to reddit submit to hacker news tweet your read

Once upon a time, I needed to draw some Bezier curves because I was trying to create a Japanese kanji composition system that turned strokes into outlines, and that required knowing how to offset Bezier curves and... at the time (2011, time flies) there was no good single source of information for Bezier curves on the web. So I made one. Sure it started small, but it turns out that if you just keep adding bits to something, several years later you have quite the monster, and a single HTML file becomes intractible.

So, in 2016, when React.js exploded onto the scene, I rewrote the primer as a React app, and it became a lot easier to maintain. Like, a lot a lot. However, there was a downside: no JS meant no content. Sure, server-side rendering sort of existed, but not really, and because the Primer is hosted through github, there was no "server" to run. Plus, trying to rehydrate an app the size of the Primer from a giant HTML file had truly dire performance.

So I left it a regular React app, and every time I thought "wouldn't it be nice if it was just... a web page again?" the browser landscape just hadn't caught up. Finally, in 2020, things are different: with a global pandemic, and some vacation time, and something random causing me to look up the state of HTML custom elements, everything was pointing at it being time to finally, finally, turn the Primer back into a normal web page.

The new tech stack is, frankly, pretty amazing. It does some things that weren't possible even half a year before I started the rewrite, let alone being possible in 2016, and so because so much has changed, this post will be the first in a series of posts on how the new tech stack works.

To give a bit of a teaser, some of the things I'll be writing about:

Scripts are disabled. Showing fallback image.
1
2
3
4
5
6
7
8
9
10
11
12
13

It's going to take me a while to detail the entire tech stack, but ultimately what matters is that you get a Primer that is a normal "vanilla" HTML, CSS, and JS page again, that "just works" even with JS disabled.

Enjoy The new Primer on Bézier Curves, and if you find any problems, you know where to go.

See you in the next post!

Pomax