XI.
Rubyist static site generators, and a historical aside.
Last fall, after years of creating highly dynamic websites and web applications, I reversed directions. Now I aim for as much static HTML as possible. It’s simpler, faster, cleaner, more elegant, easier to read, and for most projects it’s all you need.
Hypsography and Hypsometry, for example, are both entirely static. Hand written HTML, CSS, and Javascript, served up simple and fast.
This site, the Hypsometry Blog, is built with Jekyll, Tom Preston-Werner’s elegant little Ruby hacker blogging tool. Jekyll takes Liquid templates and fills them with marked-up text, sprinkling a little YAML data over the top, and outputs HTML ready for your server. That works well.
Hypsography, however, is getting to the point where I don’t want to be maintaining all the code by hand (albeit with heavy help from Textmate), but I also don’t want to lose the simplicity and speed of serving static files. There’s no need to migrate to a full-bore content management system, with all the configuration and maintenance hassles that inevitably entails. Jekyll’s wonderful, but it’s not usable on sites that aren’t simple blogs.
Since Jekyll was released, a slew of static site generators written in Ruby have come along (and some have gone right along too). They all have a basic philosophy similar to that originally outlined by Tom Preston-Werner:
They all take templates and content and merge them together, creating static HTML sites ready for deployment. They tend to use YAML for configuration. Most accept multiple markup formats as input. They all can watch your directory for changes in order to rebuild the site dynamically as you work on it.
Their differences are smaller, but important. Each has a slightly different approach to the same problem, and thus each meets a slightly different need.
Having spent the past couple days (for the second time in six months) going through the options and evaluating them, I thought I’d summarize what I’ve found. Let me point out that all the programs discussed below seem excellent and worth investigation. There are other programs out there which seem less excellent, and I’ve ignored those here. Please let me know if I’ve missed anything, of course.
(There is one other useful approach to all this: Writing your own generator using Rake, YAML, and Mustache. This is quite appealing, but not what I’m in the market for today. Chris Wanstrath wrote about his approach last year, if you’re interested.)
Here follows my one-sentence summaries of all the Rubyist static site generators that I’ve looked at recently:
Bonsai.
Beautiful, simple, flexible (uses Tilt for template handling), progressive (HTML5 by default), but the current version doesn’t work out of the box and it’s intended primarily for portfolio sites. (Project site, Github.)
Middleman.
Rails-like (in ways both good and bad), highly configurable and flexible, and includes automatic minification of CSS and Javascript, as well as other useful optimizations. (Introductory post, Github.)
Nanoc.
Extremely powerful and extensible, perhaps too much so, and prefers configuration to convention. (Project site, Github.)
Staticmatic.
Simple, clean, but strangely Haml-dependent. (Ruby Forge, Github.)
Webby.
Simple, flexible, quite Jekyllish. (Ruby Forge, Github.)
Webgen.
Powerful, extensible, slightly rigid in operation. (Ruby Forge, Github.)
Not quite a conclusion.
That’s the list, and those are my notes. You can probably guess which I’m going to try out on Hypsography, but whether or not you can, you’ll be hearing more about the results here.
A historical aside.
Since I wrote once before about static site generation, I’ve taken this opportunity to begin restoring old articles to the Hypsometry Blog. As such, there is now an article zero: Nulla, actually, since the Romans didn’t really have notation for zero.
Nulla serves as a marker. All articles older than it are reprints, numbered negatively (which is also an anachronism, but hey), and probably slightly altered from their original forms. All articles newer are indeed new, part of this latest iteration of the Hypsometry Blog.
As time passes, I’ll continue working my way through the Hypsometry archives, digging out other older articles perhaps worthy of a second look. Or at least worthy of having their links preserved. Don’t take them too seriously – they’re oldies, but not necessarily goodies.