HAML is a template language that is meant to make writing html less of a drag. It was very common for myself to forget closing brackets and div tags which always annoyed me greatly, but I avoided the simplicity of HAML because I wanted to force myself out of that bad habit. HAML does not require any brackets and works with spacing and indentation to convert the valid html.
I initially reaction when started the project was to convert the existing HAML into/erb right away, but I then read an article from Hashrocket and found they used HAML exclusively and it got me thinking, maybe it's time for start learning this.
Here is an example of html converted to haml:
Learning Ruby/Rails first introduced me to erb and I love it and understand it, which is another reason why I avoided HAML.
I have since stopped work on this project but did walk away with some more experience in this templating language. I can't say I would go for HAML at the start of a project but I don't think I need to avoid it anymore. I will definitely give it another shot on one for my smaller projects, especially since I am pretty sure this is not the last I will see of it.
If you come across HAML somewhere I recommend learning it and use tools like hamle2erb or htmltohaml
No comments:
Post a Comment