Skip to content

Getting a proper "storybook"-ish renderer for Kittybox's templates was a good idea β€” now I can quickly iterate on the design of my comments section without actually running the app or populating the database with fake content!

I just pipe an MF2-JSON blob down a single executable, and out comes an HTML page I can view in my browser. Basic CSS is inlined so it looks almost the same as the finished product. The only thing broken is the font style, because the fonts are supposed to be fetched from the static folder, and the static folder isn't there in a self-contained HTML file.

I could probably produce an assets folder and rewrite all <link> URLs to point to that folder, but it's too much hassle for a simple hack. And it allows me to view what my pages would look like without custom fonts, which I heard some people forbid in their browsers anyway for bandwidth reasons.

…or I could just install the same font families on my machine. If I could be bothered doing that.

This solution doesn't require me to spin up a web server, doesn't require me to run anything, doesn't require me to run or manage a staging database filled with fake data, doesn't require me to submit web forms to configure template parameters, it does one thing and does it well. And it would probably run in CI, too, if I wanted to make snapshot tests. (Though in-crate tests are probably better for that purpose.)