Ruby template engine. The feature is that it does not require a closing tag like html.
In addition, end
such as conditional branching is not required and all are judged by indentation.
Therefore, if the indentation shifts even a little, an error will occur. be careful.
--<>
Not required
<%%>
→ -
<%= %>
→ =
<div class="hoge></div>
→ .hoge
<div id="hoge"></div>
→ #hoge
As above. It's really easy.
class
hoge.html
<div class="hoge huga">Hello!</div>
hoge.slim
.hoge.huga Hello!
if statement
hoge.html
<% if user_signed_in? %>
<li>New post</li>
<% else %>
<li>Login</li>
<% end %>
hoge.slim
- if user_signed_in?
li new post
- else
li login
/end not required
that's all. It became a simple article, but please refer to it ^ ^
Recommended Posts