What Javascript Template Engines you recommend? [closed]

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


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).


May be PURE — it allows to transform JSON into HTML with templates made from your existed html, not from separate template with special syntax.

From the PURE's site:

Simple and ultra-fast templating tool to generate HTML from JSON data

The representation (HTML) and the logic (JS) remain totally separated

Works standalone or with dojo, DomAssistant, Ext JS, jQuery, Mootools, Prototype, Sizzle and Sly

The best way to understand is to see what this library actually do: (from official demo) pure template engine demonstration

All the demos are here


LinkedIn went with dust.js http://akdubya.github.com/dustjs/


Pick the template language that has an api and syntax you find most appealing. If you run in to performance problems, then you can look at alternatives.

Unless you are constructing tables with thousands of rows, you probably won't notice a difference.

Personally I use Google's Closure Templates. I chose it mainly because it also has a Java implementation. I have never done benchmarks.