5. Main ideas of Haml
Markup should:
● be beautiful
● be clean
● be sensible
● follow the rules
6. Rules of indentations
.some_div
line one
line two <div class='some_div'> line one line two </div> <div
class='some_div_two'> line one </div>
.some_div_two line two
line one
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.
11. Perfomance
Haml - 0.00033s
ERB - 0.000222s
Slim - 0.000254s
Код:
Haml ERB Slim
%h1 Haml#index %p Find me in <h1>Erb#index</h1> <p>Find me in h1 Haml#index p Find me in
app/views/haml/index.html.erb =@haml app/views/erb/index.html.erb</p> <%= @erb % app/views/slim/index.html.erb = @slim
>
12. 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
13. Now you can see that Haml is
REALLY better than erb
You also can take a look for my blog graffzon.com