I will explain how to install and use the Ruby template engine
In Rails, I write html in a file called
html.erb, but it is a little troublesome to fill in
<h1> </ h1>and
slim, you can write html more concisely and reduce the development effort.
gemfilein the rails directory.
gem 'slim-rails' #Gem for using slim with rails gem 'html2slim' # html.erb html.Gem to convert to slim
bundle installin the terminal to reflect the gem addition.
bundle exec erb2slim app/views app/views
bundle exec erb2slim app/views app/views -d
git committo record the status of the file. ** If you delete a file and have problems, you can revert to the state it was in before
git log #Examine the hash value
git reset --hard hash value #The hash value that came out--Enter after hard to return to the specified commit.
List the basic usage of slim.
<% if %>
<%= puts hoge %>
= puts hoge
p | hoge
<> is not needed
<div id = id></div>
<div class = hoge></div>
<!-- hoge -->
If you compare html and slim, you can see that it is very simple to write.
If you would like to know more detailed information, please refer to the following URL.