Answer the question
In order to leave comments, you need to log in
How to properly set haml-rails indentation?
Just added the haml-rails gem.
Regenerated all views. He did not regenerate some of them due to errors (some unsupported characters). God bless him. I think that he did not - I will do it myself.
And because I am not strong in haml almost at once the question was formed. I have the following erb:
<% if condition1?%>
<div class="c1">
<% elsif condition2?%>
<div class="c2">
<% else %>
<div class="c3">
<% end %>
<div>Этот див вставлен в другой</div>
</div>
- if condition1?
.c1
- elsif condition2?
.c2
- else
.c3
%div
Этот див вставлен в другой
Answer the question
In order to leave comments, you need to log in
Haml has a strict hierarchy, so the last div must either be nested in all cases, or the class must be calculated separately, like so:
- klass = 'c3'
- if condition1?
- klass = 'c1'
- elsif condition2?
- klass = 'c2'
%div{class: klass}
%div
Этот див вставлен в другой
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question