I’m typing this from an internet cafe in London right now. One pound for one hour’s worth of internet access is a great deal.
So, I was holding off on writing about HAML until it was officially unveiled at RailsConf Europe where it’s creator and I were graciously flown by our employer, Unspace Interactive. Now that the conference is over, it’s time to spread the word.
HAML is a new templating engine for Rails that enables you to write truly beautiful templates. Created by one of my esteemed collegues, Hampton Catlin, I’m proud to say that I played a minor role in its evolution: I refactored the codebase, added some tests, and wrote the rdoc. The real credit goes to Hampton, of course. I’m merely a supplicant and a votary. But I’m the only HAML commiter besides Hampton, which makes me better than you.
HAML in action
Let’s take a breif look at HAML in action:
%html
%head
%title HAML Demo
%body
#container
.content
%p Stop. HAML time
That’s it. No annoying tags to close, no need to specify the tag name when all we want is a div, and best of all, the # and . characters mimic those of CSS. Here’s the output:
<html>
<head>
<title>HAML Demo</title>
</head>
<body>
<div id='container'>
<div class='content'>
<p>Stop. HAML time</p>
</div>
</div>
</body>
</html>
Now that your mind has been completely blown, you should download HAML and try it for yourself.
Resources for your reading pleasure
Installation as a Rails plugin
HAML is available as a Rails plugin. To install it, type the following from the root of your Rails project:
./script/plugin install svn://hamptoncatlin.com/haml/trunk
Once installed, you can start creating templates with the .haml extension.
PS: I have yet to mention Unspace on this blog. Thankfully, I work there now. With Hampton, Pete, Ryan, Anthony, and John. More about that soon, swear to god.


I’ve looked through tons of templatesystems through the years and I have to say that this looks really fresh.. is there support comming for multiple rubylines for loops etc?
The jury is still out on whether or not we’ll add support for blocks and loops, but multiple lines might be a possibility in the near future. A few people have submitted patches; we’ll look more closely at them when we get back from London.
We’re also going to be adding the ability to use HAML as a straight-up engine (sans Rails project) so you can require it in your Ruby programs and go to town.