Skip to content
Precompiles doT.js templates files into a single CommonJS module.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
README.md
dot-module.js
package.json

README.md

dot-module

dot-module lets you simple transform your templates directory into one CommonJS module. Best served with modules-webmake. Some ideas (and the example below) took from dot-packer.

Installation:

npm install -g dot-module

Usage:

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

Options:

-d  Target directory <path>
-o  Output file <path>

Example:

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 to your code, you can access the template like this:

var templates = require('./templates'),
    scores = templates['scores'];

container.innerHTML = scores({
  scores: user.scores
});

Something went wrong with that request. Please try again.