When comparing Liquid vs ERB, the Slant community recommends ERB for most people. In the question“What are the best Ruby templating languages?” ERB is ranked 2nd while Liquid is ranked 4th. The most important reason people chose ERB is:
Since ERB is included with Ruby out of the box, there is no additional installation and setup required. The fact that it's included by default in Ruby, a lot of projects use it.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Clear distinction between presentation and application
Liquid allows developers to create a clear distinction between the presentation and application layer.
Pro Secure
Liquid templates are secure out of the box. They can be used for applications where users can edit the appearance without allowing them to run any server-side code. Liquid does just that without any needed configuration.
Pro Comes with Ruby
Since ERB is included with Ruby out of the box, there is no additional installation and setup required. The fact that it's included by default in Ruby, a lot of projects use it.
Pro HTML with embedded Ruby
ERB is a way to embed Ruby into plain HTML, which means there is no need to learn a new syntax for HTML. This makes ERB fast to learn, and a great option to use on projects that have multiple developers/designers.
Pro Familiar even for developers with no Ruby experience
ERB's interpolated tags are very familiar to developers who have worked with PHP, ASP or JSP, even though they may not have any prior experience with Ruby.
Pro Maintained by Ruby on Rails developers
Due to Ruby on Rails (RoR) use of ERB, the developers of RoR will continue to maintain ERB, guaranteeing project health.
Pro Best Performance
It has the best performance of all of ruby templates, although it wasn't designed for productivity as HAML or SLIM.
Cons
Con Boolean algebra has some issues
Liquid has some known issues with boolean algebra when it comes to some advanced expressions.
Liquid::Template.parse("{% if false and false or true %} foo {% endif %}").render
# => ""
false and false or true
# => true
It seems that Liquid simply parses from left to right, and if it finds a false and X
it immediately returns false.
Con Verbose
Since ERB uses HTML syntax with Ruby logic inside it can get a little verbose like HTML files usually do.
