Haml 1.7.2 - Now Merbilicious!

Posted November 18, 2007

Update: As of Merb 0.5, Sass works out of the box. No dependency stuff necessary.

Another release announcement! This time, it’s Haml 1.7.2 that’s being released. Although this is just a build release, there’s actually a lot of cool stuff there. I strongly reccommend upgrading.

If you want to do so, pay attention: we’re recommending a different installation method for Rails this time around. Instead of doing ./script/plugin install, install the Haml gem and use that to install Haml in your application:

gem install --no-ri haml
haml --rails path/to/app

That’ll add a stub plugin to your Rails application that will load the Haml gem and run that. That way you can keep all your Haml installations up to date just by upgrading the gem.

Build releases typically don’t add new features; they just fix bugs and stuff like that. That’s mostly true for this release, but there’s one exception: Sass now works with Merb.

Merb, for those who haven’t heard of it, is a very snazzy new web framework written in Ruby. It’s similar to Rails in that it has a Model-View-Controller architecture, but it’s much more lightweight and plugin-based. Check out the website for the full scoop.

Merb actually comes with Haml support out of the box. As long as the Haml gem is installed, .html.haml templates will work in any Merb project.

Unfortunately, Sass wasn’t quite so easy. This is mostly because Sass isn’t really a template language; it’s designed to render stylesheets once and let them be rendered statically from then on. Making stylesheets views doesn’t really make sense.

The way we deal with this in Rails is to put Sass sheets in public/stylesheets/sass. However, this requires a bit of Rails-specific code to ensure that the stylesheets are properly recompiled whenever they’re modified. This didn’t exist for Merb.

Until 1.7.2. Now all you have to do is add dependency "haml" to config/dependencies.rb and Sass sheets will work just like in Rails. The directories are even the same: public/stylesheets/sass/main.sass compiles to public/stylesheets/main.css.

There are plenty of bugs and other issues fixed, as well. Most of these were patched or pointed out by our fantastic userbase; the following people contributed changes that were incorporated into 1.7.2:

Thanks, folks!

Make your comments snazzy with Textile!