node package manager

dot-module

Precompile doT.js templates and build CommonJS module.

dot-module

dot-module lets you simple transform your templates directory into one CommonJS module. Best served with modules-webmake.

npm install -g dot-module
dot-module -d templates/ -o ./templates.js
-d 	Target directory <path>
-o	Output file <path>

Create a doT.js template (templates/sample.html). Templates must have a .html extension.

<ul id="scores">
	{{~it.scores:score:index}}
		<li>{{=score}}</li>
	{{~}}
</ul>

dot-packer -d templates/ -o ./templates.js

Once you include the templates.js module in your webpage you can access the template in javascript.

var templates = require('./templates'),
scores = templates['scores'];
container.innerHTML = scores({
  scores: user.scores
});