concatenating the client scripts, instead of compressing, in development mode

v1.18.x
Julian Lam 11 years ago
parent 3860abdc24
commit 4c2a6953f1

@ -299,21 +299,24 @@ var fs = require('fs'),
this.cache = minified.code; this.cache = minified.code;
callback(); callback();
}, },
compress: function(callback) { concatenate: function(callback) {
var uglifyjs = require('uglify-js'),
jsPaths = this.scripts,
compressed;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
winston.info('Compressing client-side libraries into one file'); winston.info('Concatenating client-side libraries into one file');
} }
minified = uglifyjs.minify(jsPaths, { async.map(this.scripts, function(path, next) {
mangle: false, fs.readFile(path, { encoding: 'utf-8' }, next);
compress: false }, function(err, contents) {
if (err) {
winston.error('[meta.js.concatenate] Could not minify javascript! Error: ' + err.message);
process.exit();
}
Meta.js.cache = contents.reduce(function(output, src) {
return output.length ? output + ';\n' + src : src;
}, '');
callback();
}); });
this.cache = minified.code;
callback();
} }
}; };

@ -57,7 +57,7 @@ var path = require('path'),
}); });
} else { } else {
// Compress only // Compress only
meta.js.compress(function() { meta.js.concatenate(function() {
sendCached(); sendCached();
}); });
} }

Loading…
Cancel
Save