Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 50 lines (42 sloc) 1.14 KB
#!/usr/bin/env node
const _ = require('underscore');
const uglify = require('uglify-js');
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();
var bliss = template = source = ast = code = undefined, compileStart = compileStop = 0;
bliss = new Bliss();
try {
compileStart = Date.now();
template = bliss.compileFile(args.shift(),{
context: {
_: _
}
});
compileStop = Date.now();
source = template.toString();
}
catch (error) {
source = error.templateSource;
console.log('[ERROR]',error.toString());
}
try {
formattedSource = uglify.uglify.gen_code(uglify.parser.parse(source),{
beautify: true,
indent_start: 0,
indent_level: 2,
space_colon: true
});
console.log(formattedSource);
}
catch (error) {
console.log(source);
}
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(' */');