Git Product home page Git Product logo

dot's Introduction

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

Note about doU.js:
	doU.js is here only so that legacy extrenal tests do not break. Use doT.js.
	doT.js with doT.templateSettings.append=false provides the same performance as doU.js.

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

	doT is licensed under the MIT License. (See LICENSE-DOT)

dot's People

Contributors

olado avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.