Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 54 lines (47 sloc) 1.63 KB
#!/usr/bin/env node
const _ = require('underscore');
const minifier = require('html-minifier');
const util = require('util');
const Bliss = require('..');
const args = _.map(process.argv,_.identity);
const nodeExec = args.shift();
const nodeScript = args.shift();
try {
var bliss = template = output = undefined, compileStart = compileStop = renderStart = renderStop = 0;
bliss = new Bliss();
compileStart = Date.now();
template = bliss.compileFile(args.shift());
compileStop = Date.now();
renderStart = Date.now();
output = template.apply(null,args);
renderStop = Date.now();
console.log(output)
console.log('<!--')
console.log(' generated by:','Bliss','(https://github.com/cstivers78/bliss)');
console.log(' generated on:',new Date());
console.log(' compile time:',compileStop-compileStart,'ms');
console.log(' render time:',renderStop-renderStart,'ms');
console.log('-->')
}
catch (thrown) {
console.error('')
console.error('[error]',thrown.toString(),'at',thrown.fileName+':'+thrown.lineNumber);
console.error('')
lines = template.toSource().split('\n');
start = thrown.lineNumber - 3 > 0 ? thrown.lineNumber - 3 : 0;
end = thrown.lineNumber + 2 < lines.length ? thrown.lineNumber+2 : lines.length;
for(l=start; l<=end; l++) {
line = lines[l];
if ( line === undefined )
continue;
if ( l == thrown.lineNumber-1) {
marker = _.map(lines[l].split(''),function(){return '-'}).join('')
console.error('[error] ----'+marker)
console.error('[error]',l+1,':',line);
console.error('[error] ----'+marker)
}
else {
console.error('[error]',l+1,':',line);
}
}
}
Something went wrong with that request. Please try again.