dot-packer

Precompile, compress, and pack doT.js javascript templates into one file

npm install dot-packer
13 downloads in the last month

dot-packer.js - precompile,compress, and pack doT.js javascript template(s) into one js file.

dot-packer

Installation:

npm install -g dot-packer

Note: Based on your permissions you may have to use sudo

Dependencies:

  1. doT - The fastest + concise javascript template engine
  2. UglifyJS – a JavaScript parser/compressor/beautifier

    Note: NPM should install these automaticly

Usage:

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

Options:

-d     Target directory <path>
-o    Output file <path>
-n  The GLOBAL variable to pack the templates in. (default:JST)

Example:

Create a doT.js template (templates/sample.jst). Templates must have a .jst 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 file in your webpage you can access the template in javascript.

html = JST.sample(data);
npm loves you