Friday, July 2, 2010

Assign Multiple Class Names to an HAML Element

Let's say you want to convert the following HTML to HAML:

This is an out-of-character message.

In HAML, instead of joining the class names with spaces, you chain them with dots:

%div.message.ooc This is an out-of-character message.

If you've used HAML for a significant amount of time, you likely already know this. Sadly, as many times as I've used class name chains in HAML, it seems enough time has lapsed that I've forgotten the syntax, and I have to look it up again.