Rendering HAML partials from within HAML outside of Rails

hamlruby

I'm using HAML to generate some static html pages for a site, and I was wanting to split out common components into partials that I can include in multiple pages, just like in Rails. However I don't want to use the whole Rails stack to do this as it seems like overkill.

I've looked around on the Internet but haven't found anything, better than just doing something like:

Haml::Engine.new(IO.read("header.haml")).render

Is there a nicer way of including so-called partials from within HAML? An existing filter or command that I'm missing?

Best Answer

It's best to combine haml & sass with a tool for building static websites. Here's some links:

I'm using jekyll for my blog, but if you're not building a blog it's probably not appropriate for your needs.