Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Javascript Template Engines you recommend? [closed]

I would like to know your opinion about javascript template engine, which one you think is better in terms of performance?

I found some links where people do benchmarking:

http://jsperf.com/jquery-template-table-performance/15

http://jsperf.com/jquery-template-table-performance/8

http://www.viget.com/extend/benchmarking-javascript-templating-libraries/

like image 205
kaha Avatar asked Oct 17 '11 01:10

kaha


People also ask

Which is better Pug or EJS?

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.

Is JavaScript a template engine?

JavaScript templating engines enable you to add dynamic logic to static HTML pages. For instance, you can declare a variable that the engine replaces with an actual value at runtime. Similarly, you can use conditionals, loops, filters, mixins, and other constructs, depending on the templating engine you choose.


2 Answers

Template-Engine-Chooser! - Tool to help select the right template engine for a project.

like image 85
CD.. Avatar answered Sep 19 '22 03:09

CD..


In terms of performance I found that it is not the templating engine itself but more if there is the possibility to precompile the templates. It is a good practice to concatenate and minify all your JavaScript source files into one file for production mode anyway, so it is basically the same step to precompile the templates, too.

I've used jQuery template and Mustache for client side templating, but my favorite is still EJS which always peformed a lot faster than anything else I tried so far, especially in production mode (compiles to native string concatenation whenever possible and needs only one DOM access to actually insert the rendered view). It is part of the JavaScriptMVC framework and when using it with StealJS as the dependency manager it does all the template compiling into production for you already (the View Engine also supports Micro, Mustache and jQuery template).

like image 24
Daff Avatar answered Sep 22 '22 03:09

Daff