Stick with ERB or move to Haml
Haml is gaining popularity in Rails community. It claims higher productivity compared to defacto ERB templating. Not everybody agrees though. I see 2 short-term problem with haml.
- ERB is similar to it pre-decessor and hence easier to learn. Compared to JSP etc. ERB is similar, you still see lots of HTML tag with interleaved ruby (or Java). Although verbose, it is closer to how your HTML would finally look like.
- If your team has a dedicated HTML programmer (Designer as we may call them). These folks are very good at plain HTML and don’t want the trouble of converting files and having all the plumbing around when working. It is not efficient for them.
Despite this, I see Haml as valid alternative for following reasons:
- Its been 2 days since I started using Haml. Obviously, I have yet to higher gain productivity but tools like html2haml help a lot with the transition. I am beginning to see that I am not far behind, in terms of productivity, compared to ERb already.
- Especially if you don’t have a dedicated Designer/HTML programmer on your team, haml gives you another shot at productivity.
- I am not sure if this is a good idea but you can have both on the same project, but it sure does work. In fact, you can even have layouts, partials and your main page in different templating engine. Atleast, it lowers the barrier to get started.
- Haml gets ugly when there is too much html nesting. This is a good thing since it encourages breaking your view into partials and making it modular.
- Haml also promotes better view design by making divs/ids/classes most concise. If you are still using tables a lot, you may find yourself using divs with haml.
Try it out. It’s not that bad.
Enjoy!
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.






Many designers prefer Haml to HTML. It’s closer to CSS and closer to the structure of the document, which is how they think about it in the first place.
Nathan Weizenbaum
3 Jun 09 at 7:42 pm