Fork me on GitHub

The fastest + concise javascript template engine
for Node.js and browsers.

Origins

xDoT is based on dotjs template engine by Laura Doktorova, but converted to TypeScript and includes some enhancements

Source

github.com/udamir/xdot

Usage play with it, edit and see results as you type

Template

Compile-time defines (def)

xDoT.template compiles it into

Data

Result

Compile time evaluation vs Runtime evaluation

You can improve performance further if you use compile time evaluation. It is useful in cases when the data that you want to use are not changing with each run of the template. Think of it as defines or constant variables.

It is also used to statically compile partials. This comes in handy when you want to include similar header and footer on multiple pages. doT also allows to customize partial right from the template that will include it.

Check advanced sample for hints on how to use defines and partials.