Skip to content

Commit

Permalink
[compiler] beautify code
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Oct 23, 2011
1 parent 58b0b66 commit 390e83d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/xjst/compiler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var xjst = require('../xjst'),
vm = require('vm'),
uglify = require('uglify-js'),
utils = xjst.utils,

XJSTParser = xjst.ometa.XJSTParser,
Expand Down Expand Up @@ -197,7 +198,8 @@ exports.generate = function generate(templatesAndOther) {

exports.compile = function compile(code, filename) {
var parsed = exports.parse(code),
compiled = exports.generate(parsed);
compiled = exports.generate(parsed),
beautified = uglify(compiled, { gen_options: { beautify: true } });

return vm.runInThisContext(compiled, filename);
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"bin" : { "xjst" : "./bin/xjst" },
"dependencies" : {
"coa": "0.1.x",
"ometajs" : "2.0.x"
"ometajs": "2.0.x",
"uglify-js": "1.1.x"
},
"devDependencies": {
"benchmark": "0.2.x",
Expand Down

0 comments on commit 390e83d

Please sign in to comment.