Static Blog Generator with Dart & Jaspr
I was happy to recently discover the jaspr project, a Dart framework for generating dynamic and static HTML/JS pages with a pseudo-Flutter syntax.
It's a far better alternative to Flutter web, at least for general purpose web pages or even certain basic web applications.
For one, SEO is a non-starter when it comes to Flutter web apps. Text elements are rendered straight to a canvas, so search engine crawlers will have a hard time indexing content.
The bundle size for a Flutter web app is also relatively large: last I checked, release builds using the HTML renderer were ~1.4mb (and a CanvasKit build clocked in at around ~6.5mb!). That's way too much for a static site, where load time is a priority.
I was looking for a Dart-based static site generator to consolidate a few of my sites (including this one). I had been using a mixture of Hugo, PHP, and vanilla HTML/JS, and it was getting to be a pain. I wanted a simple tool that I could point to a directory of .md
files, and generate static HTML with the appropriate routing and styling for upload directly to Cloudflare.
jaspr's static site generation offered the majority of what I needed, and I wrote a small extension to cover the remainder (markdown parsing, basic templating, route configuration). I've open-sourced the repository, though (as usual) it's not very well documented at this stage.
I've started eating my own dog food, having moved over both this site and the Polyvox blog. I've noticed a few painful omissions (code formatting is broken, and there's no way to specify custom tags or otherwise directly embed Javascript or an iframe), which I'll gradually address when I have the time.