Hacker News new | ask | show | jobs
by epochwolf 5541 days ago
Haml user here. I use haml because it allows me to see an entire page's code in a much cleaner format than erb with HTML. I can hammer out or rearrange chunks of HTML much faster in haml. To draw a comparison: haml is to HTML as yaml is to XML. Haml is denser and cleaner but it won't do everything. I still use erb and HTML for some templates because the haml just gets ugly.

Edit: a note, I am plenty comfortable writing vanilla HTML, I just prefer the speed and clarity of haml.

1 comments

Just a tip: most of the time, when your haml gets messy, you can clean it up dramatically by using the :textile, :markdown, or :javascript formatters (or just put regular HTML in the :erb or :plain formatters).
I did not know of the :erb/:plain formatters, thanks for the suggestion.
You can even use string interpolation in them :)

i.e.:

  :textile
    Hi, my name is *#{@user.name}*!