26 lines
597 B
JavaScript
Executable File
26 lines
597 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
var fs = require('fs'),
|
|
handlebars = require('../lib/handlebars');
|
|
|
|
var argv = require('optimist').argv;
|
|
|
|
var template = argv._[0];
|
|
|
|
// Show help prompt if requested or if the
|
|
// incorrect usage options are supplied
|
|
if (argv.h || argv.help || !template) {
|
|
console.error("Usage: handlebars.js template");
|
|
return;
|
|
}
|
|
|
|
// First figure out what our output looks like
|
|
fs.readFile(template, 'utf8', function(err, data) {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
|
|
var options = {};
|
|
console.log('Handlebars.template(' + handlebars.precompile(data, options) + ')');
|
|
});
|