I’m a big fan of preprocessing. I prefer Slim, Sass, and CoffeeScript to plain HTML, CSS, and Javascript. They are cleaner to read and easier to type. They are also very easy to use in Rails. But what about using them for static sites, without Rails?
Although Sass and CoffeeScript have command line compilers, I couldn’t find anything as easy to use for Slim.
In the end, I realized that the right way to go is using Middleman, a Ruby framework for building static sites and blogs. It uses the same sort of asset pipeline as Rails does, so all of the compiling and preprocessing is done for you. It’s livereload feature is a big win for productivity as well. In short, it sets everything up exactly as you need it for a killer static site workflow that includes html and asset precompilation, without you having to worry about the detailed configuration.
So, how can you compile Slim on the command line to use in a static site? My answer would be: don’t — save yourself some trouble and use Middleman instead!