Haml Templating Haiku

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.

About Haml