Haml is an abbreviation for HTML Abstraction Markup Language. A markup language for generating html (which can also generate xml). Since the amount of description is smaller than that of html and indentation is forced, it is possible to create it very neatly and concisely.
gemfile
gem 'haml-rails'
↓
Terminal
$ bundle install
↓
Terminal
$ rails haml:erb2haml
Terminal
Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)
Is it okay to delete the conversion source .erb file? Is asked, so press y → enter here to complete.
I've been writing code in erb for a long time, and I was impressed that the amount of description was significantly reduced and it became easier to see just by changing to haml. However, when I looked it up, it seems that there are people who are difficult for engineers to do, such as the difference in performance between haml and erb, grammar, whether it is the default, etc. That looks good.
That was a memorandum.
Recommended Posts