Building a static website with Ribosome and Node.js
13 Jul 2016I've transitioned the website from Jekyll to a custom system based on Ribosome. I wasn't updating the website very regularly, and each time I picked it up again, I had to spend an hour or so battling the particularly horrible Ruby dependencies on Windows.
Ribosome is essentially a templating engine driven by a script language (JavaScript, Python or Ruby — I went with Javascript). It takes a js/py/rb script as input, which also contains lines starting with a dot. The script is run, but whenever a dotted line is encountered, it is sent to an output file. It supports embedded expression within dotted lines, special directives to change the file to which the output is redirected and include other files. This makes it possible to generate your whole website from a single script (have a look at mine).
Something I really like about Ribosome is how it respects whitespace, resulting
in really nice-looking output, unlike most templating engines (have a look at
the html for this page [1]). It's block layouting capability is also quite
handy.
I'm also very pleased about the Node.js ecosystem. I was really easy to find libraries to parse YAML front matter, parse Markdown, manipulate dates, escaping html and create temporary files. They were easy to use too.
All in all, updating the website was a surprisingly pleasant experience. Ribosome in particular is great, I encourage you to try it.
[1]: I was forced to flush the content to the left, otherwise <pre>
tags would
pick up additional whitespace. HTML sucks.