Moments of Joy: Technical Solutions
Published on under the Coding category. Toggle Memex mode
I have a static website. This means that whenever I make a change to the site I need to "rebuild" each page. This involves taking the content of the page -- for example, a blog post -- and turning it into a full page, ready to be served to a reader. I built a custom tool to generate my site as an engineering challenge. I had -- and have -- a lot of fun tinkering with my site, even though the underlying source code is not as elegant as it could be.
When I generated my site this morning, 2,477 pages were made. The majority of these are posts (which comprise ~700 of the pages) and the archive pages that correspond to each post. I create a page for each day and month on which I have published a post.
Herein lies a problem: Every time I make a change, I had to rebuild those pages. It took around a minute to see any change to my site. This made changing details like the design of a page frustrating. My posts would generate first, then every other page (and I usually only need to edit every page that isn't a post).
To help reduce the time it takes to see changes when I am developing my site, I was thinking about adding dependency graphs and implementing incremental regeneration, or potentially moving to a tool like 11ty.
Then...
I was on a call with a friend yesterday who helped me find a delightfully elegant solution to my problem. Rather than rebuild every page, I could build every page other than my posts. This cuts down the time to see a change on my site from one minute to ~6 seconds [^1].
Now, I can stick with a tool that (mostly!) works, and that implements a lot of custom features, without adding unnecessary complexity. I'm delighted.
[^1]: Six seconds might seem like a long time, but little idiosyncrasies like this are fine with me for this site. Like me, this site isn't perfect. This site is delightfully quirky to its bones.
Responses
Comment on this post
Respond to this post by sending a Webmention.
Have a comment? Email me at readers@jamesg.blog.
