|
|
|
@ -7,6 +7,7 @@ var winston = require('winston'),
|
|
|
|
|
_ = require('underscore'),
|
|
|
|
|
os = require('os'),
|
|
|
|
|
nconf = require('nconf'),
|
|
|
|
|
cluster = require('cluster'),
|
|
|
|
|
|
|
|
|
|
plugins = require('../plugins'),
|
|
|
|
|
emitter = require('../emitter'),
|
|
|
|
@ -120,6 +121,7 @@ module.exports = function(Meta) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Meta.js.minify = function(minify, callback) {
|
|
|
|
|
if (!cluster.isWorker || process.env.cluster_setup === 'true') {
|
|
|
|
|
var minifier = Meta.js.minifierProc = fork('minifier.js', {
|
|
|
|
|
silent: true
|
|
|
|
|
}),
|
|
|
|
@ -138,6 +140,15 @@ module.exports = function(Meta) {
|
|
|
|
|
winston.info('[meta/js] Compilation complete');
|
|
|
|
|
emitter.emit('meta:js.compiled');
|
|
|
|
|
minifier.kill();
|
|
|
|
|
|
|
|
|
|
if (cluster.isWorker) {
|
|
|
|
|
process.send({
|
|
|
|
|
action: 'js-propagate',
|
|
|
|
|
cache: minifiedString,
|
|
|
|
|
map: mapString
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
@ -184,6 +195,11 @@ module.exports = function(Meta) {
|
|
|
|
|
scripts: Meta.js.scripts.all
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Meta.js.killMinifier = function(callback) {
|
|
|
|
|