Main ideas of Haml
●be beautiful
●be clean
●be sensible
●follow the rules
Markup should:
Rules of indentations
.some_div
line one
line two
.some_div_two
line one
line two
<div class='some_div'> line one line two </div> <div
class='some_div_two'> line one </div>
line two
If we try that:
%h1 test
work?
(<h1> test
work? </h1> )
Immediately we take error:
Illegal nesting: content can't be both given on the same line as %h1 and nested within it.
Haml
%h1 Haml#index %p Find me in
app/views/haml/index.html.erb =@haml
ERB
<h1>Erb#index</h1> <p>Find me in
app/views/erb/index.html.erb</p> <%= @erb %
>
Slim
h1 Haml#index p Find me in
app/views/slim/index.html.erb = @slim
Intuitive perception
Html with css:
<div class="highlight">
this is some stuff
</div>
.highlight {
border: 1px solid #f00 }
Haml with sass:
.highlight
this is some stuff
.highlight
border: 1px solid #f00
Now you can see that Haml is
REALLY better than erb
You also can take a look for my blog graffzon.com