So there are a bunch of older questions on this topic that point to a number of options available. These two questions for example are some of the most answered on the topic:
What good template language is supported in JavaScript?
jQuery templating engines
Most of the answers to both questions are from 2008.
However in the past year or so the javascript landscape has evolved considerably. For example, the .NET JQuery extensions were recently added as official JQuery plugins.
Out of the current templating engines, which is the best one to use? Here are some options I'm aware of:
Given all these different options, which is probably the best one to choose?
I was trying to decide between Resig's Microtemplates and JQuery-tmpl, but I don't know which of the two is better or if there is a better option than either of them.
Can anyone familiar with many of the options available lend some advice on this matter?
There are a number of template engines available today, and the more popular ones include Pug (fka Jade), Handlebars, EJS, Mustache, Swig, and others.
EJS is way faster than Jade and handlebars. EJS has a really smart error handling mechanism built right into it. It points out to you, the line numbers on which an error has occurred so that you don't end up looking through the whole template file wasting your time in searching for bugs.
According to the StackShare community, Pug has a broader approval, being mentioned in 230 company stacks & 608 developers stacks; compared to EJS, which is listed in 9 company stacks and 13 developer stacks.
The ASP.NET Ajax Library's DataView should not be considered. It was deprecated before release, in favor of jQuery Templates.
I've been using jTemplates for a couple years and have found it to be solid enough. However, with jQuery Templates slated for inclusion in jQuery 1.5 core, it doesn't make sense to take an external dependency that re-implements something already included in the core library. That alone is enough reason to favor jQuery Templates, assuming you're using jQuery.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With