26 Apr
haml is awesome!
Haml is a new templating engine primarily for ruby on rails.
It's an alternative to rhtml files one generally uses with rails views.
Let's see an example:
Here is the rhtml version:
1 2 3 4 5 6 7 8 9 10 11 |
<div id='content'> <div class='left column'> <h2>Welcome to pullmonkey.com</h2> <p> <%= print_info %> </p> </div> <div class="right column"> <%= render :partial => "sidebar" %> </div> </div> |
Here we have it in haml:
1 2 3 4 5 6 |
#content .left.column %h2 Welcome to pullmonkey.com %p= print_info .right.column= render :partial => "sidebar" |
So, 11 lines written in 5 and much clearer.
I am going to start using haml for everything, it is amazing!

Sorry, comments for this entry are closed at this time.