Feb. 15, 2024, 3:19 p.m. | David Boureau

DEV Community dev.to

original content is here : https://bootrails.com/blog/erb-vs-haml/


This is an opinionated article about ERB and HAML with Rails. Let's compare each other and pick a winner.





Use case


In the Ruby-on-Rails world, they are known as templating languages. In the MVC concept, they represent "the View". Both are here to output HTML.





Example


Examples worth a thousand words, so here are two examples, one with ERB, the other with HAML. Both are strictly equivalent. I tried to put different kinds of …

article case concept example examples html languages rails ruby view words world

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Business Data Analyst

@ Alstom | Johannesburg, GT, ZA