There are some things that HAML simply won't do
Like what?
I have never bumped into anything haml wouldn't let me do. Does the author know that he can embed raw HTML with :plain and friends? (which, btw, are very rarely needed in practice)
Like what?
I have never bumped into anything haml wouldn't let me do. Does the author know that he can embed raw HTML with :plain and friends? (which, btw, are very rarely needed in practice)
I also wanted more specifics though, I felt like this was a fine opinion piece but lacked any specific world lessons.
- conditionallyNested = capture do
.foo
.bar
baz
- if f(x)
.wrapper
= conditionallyNested
- else
= conditionallyNested
Personally, I prefer this over duplicating the condition: <% condition = f(x) %>
<% if condition %><div class="wrapper><% end %>
<div class="foo"
<div class="bar">
baz
</div>
</div>
<% if condition %></div><% end %>
However, you can trivially abstract my first example out into a helper and result in code looking like this: = wrap_if f(x), :class => 'wrapper' do
.foo
.bar
baz
Much nicer looking, in my opinion. I don't consider this a workaround at all.