User Reviews

[1 total ]
about 1 year ago Avatar
Haml makes editing HTML more comfortable

    by Peter Bex

With regular HTML (or ERB), closing tags all the time and indenting gets annoying and it's too easy to get the nesting wrong, especially when you have some nested conditionally shown HTML fragments or after moving stuff around in a HTML file.

Haml fixes these problems once and for all: it replaces opening/closing tags to nest tags by using indentation to indicate the structure.

The Haml syntax makes the tree structure of HTML ... [More] much clearer and with the Emacs mode that's shipped with it, editing is really a breeze.

There are also some disadvantages: Haml's syntax does not allow hashes on both the attributes side and the content side of a tag. It also makes it hard to nest things in such a way that only the outer part of markup differ, with common inner content. You're forced to use a partial then, or repeat the inner content for each variation of outer markup.

Last but not least, inline javascript (or other types of non-html content) is painful when you need to use Ruby code in it, because the Ruby is evaluated in another environment than the surrounding template.

On the whole, Haml gets a well-deserved 4 stars, for making my Rails templating life much easier. [Less]

1 of 1 users found the following review helpful. Was this review helpful to you? |