3 var optimist = require('optimist')
4 .usage('Precompile handlebar templates.\nUsage: $0 [template|directory]...', {
7 'description': 'Output File',
12 'description': 'Source Map File'
16 'description': 'Exports amd style (require.js)',
21 'description': 'Exports CommonJS style, path to Handlebars module',
27 'description': 'Path to handlebar.js (only valid for amd-style)',
28 'alias': 'handlebarPath',
33 'description': 'Known helpers',
38 'description': 'Known helpers only',
43 'description': 'Minimize output',
48 'description': 'Template namespace',
50 'default': 'Handlebars.templates'
54 'description': 'Output template function only.',
59 'description': 'Name of passed string templates. Optional if running in a simple mode. Required when operating on multiple templates.',
64 'description': 'Generates a template from the passed CLI argument.\n"-" is treated as a special value and causes stdin to be read for the template value.',
69 'description': 'Template root. Base value that will be stripped from template names.',
74 'description': 'Compiling a partial template',
79 'description': 'Include data when compiling',
84 'description': 'Template extension.',
86 'default': 'handlebars'
90 'description': 'Removes the BOM (Byte Order Mark) from the beginning of the templates.',
95 'description': 'Prints the current compiler version',
101 'description': 'Outputs this message'
106 .check(function(argv) {
113 var argv = optimist.argv;
117 var Precompiler = require('../dist/cjs/precompiler');
118 Precompiler.loadTemplates(argv, function(err, opts) {
123 if (opts.help || (!opts.templates.length && !opts.version)) {
126 Precompiler.cli(opts);