Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The fastest + concise javascript template engine for nodejs and browsers. Partials, custom delimiters and more.
JavaScript
tree: d048da87ec

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
benchmarks
examples
LICENSE-DOT.txt
README
doT.js
doU.js

README

Created in search of the fast and concise JavaScript templating function with emphasis on performance under V8 and nodejs.

	doT can be used with nodejs and other javascript environments.

	doT.js is a blend of jQote2 and underscore.js templating functions with some additions.

	jQote2 technique provides for fast performance and also enables flushing data to the stream at any point in the generated template function, this is handy when using on server.

Features:
		custom delimiters,
		runtime evaluation,
		runtime interpolation,
		compile-time evaluation,
		partials support,
		encoding,
		control whitespace - strip or preserve,
		streaming friendly

Benchmarks:
	jslitmus is used for benchmarking.

To run the benchmarks for measuring execution of compiled templates:

	In the browser:
		navigate to benchmarks/index.html
		or go to http://olado.github.com/doT/bench.html

	With node:
		node benchmarks/templatesBench.js

	doT.js vs other engines:
		http://jsperf.com/dom-vs-innerhtml-based-templating

To run the benchmarks for measuring compilation speed:

	In the browser:
		navigate to benchmarks/genspeed.html

	With node:
		node benchmarks/compileBench.js


Install doT:
	npm install dot

	// use require('dot') in your code if you installed with npm

Usage:
	Default delimiters:
		{{= }} for interpolation,
		{{  }} for evaluation,
		{{! }} for interpolation with encoding,
		{{# }} for compile-time evaluation/includes and partials,
		{{## #}} for compile-time defines

	Other delimiters may be configured.

	To control whitespace use 'strip' option, true - to strip, false - to preserve.

	Sample:
	// 1. Compile template function
	var tempFn = doT.template("<h1>Here is a sample template {{=it.foo}} </h1>");
	// 2. Use template function as many times as you like
	var resultText = tempFn({foo: 'with doT'});

	Basic template sample: https://github.com/olado/doT/blob/master/examples/snippet.txt
	Advanced template sample: https://github.com/olado/doT/blob/master/examples/advancedsnippet.txt

License:
	doT is an open source component of http://bebedo.com

	doT is licensed under the MIT License. (See LICENSE-DOT)
Something went wrong with that request. Please try again.