$ doppel --help
usage: doppel -d context source_dir destination_dir
doppel -F context_file source_dir destination_dir
Options:
-d, --data Sets template data (via JSON string)
-F, --file Sets template data (via input file)
-x, --extension Sets template file extension
-e, --engine Sets template engine [default: "underscore"]
-V, --version Prints doppel version
--help Displays help information
engine name | default extension |
---|---|
handlebars | handlebars |
underscore | jst |
Entry point for "doppel"-ing directories.
Source directory. A directory with templates-to-compile should be at this location.
Destination directory. The location of the compiled copy.
NOTE: As of now, an existing directory will be overwritten if passed in this argument.
Context to interpolate into templates.
Callback function. Function is invoked with arguments err
, following the CPS convention.
var callback = function (err) {
if (err) throw new Error('F bombs');
console.log('Not with a ! but with a whimper');
};
var data = {
title: 'The Hollow Men'
, doctype: 'html'
, description: 'Not to be confused with Hollow Man'
, author: 'T.S. Eliot'
};
console.log('This is the way the world ends');
// Set the template engine
doppel.use('underscore');
// Pile o' copy
doppel('/templates/html', 'hollow_men', data, callback);
Configures the doppel template engine.
Template engine to use. Accepted values are listed above.
Optional settings for template engine.
doppel.use('handlebars', { extension: 'hbs' });
Brought to you by Kurt Ruppel and Steve Lloyd.