Beautifully DRY,
well-indented, clear markup:
templating haiku.
Download Haml Latest: 6.3.0 - What's New?
.erb
<section class="container"> <h1><%= post.title %></h1> <h2><%= post.subtitle %></h2> <div class="content"> <%= post.content %> </div> </section>
.haml
%section.container %h1= post.title %h2= post.subtitle .content = post.content
What is it?
Haml (HTML abstraction markup language) is based on one primary principle: markup should be beautiful. It’s not just beauty for beauty’s sake either; Haml accelerates and simplifies template creation down to veritable haiku.
Unspace Interactive and several other professional Rails shops use Haml exclusively for their projects, valuing its focus on cleanliness, readability, and production speed.
Give yourself 5 minutes to read the tutorial and then convert one of your ERB templates to Haml. Simplify. Enjoy. Laugh. 20 minutes later, you will never go back.
-
Emotions when returning to haml (after erb): 1. This code looks pretty... 2. This is madness! 3. Hey, I remember how it's done. 4. Marry me?
@eishe -
We have used Haml in every web project for the past 2 years and it has saved us an inestimable amount of time. Just brilliant.
@edenspiekermann -
The world would be a much better place if you used more HAML and less ERB. Stop being lazy and learn it today. #ruby takes over my brain.
@tobrien