v1.18.x
psychobunny 9 years ago
parent d24b15a584
commit 6e617dd69a

@ -7,16 +7,17 @@ var fork = require('child_process').fork,
module.exports = function(grunt) { module.exports = function(grunt) {
var args = [];
if (!grunt.option('verbose')) {
args.push('--log-level=info');
}
function update(action, filepath, target) { function update(action, filepath, target) {
var args = [], var updateArgs = args,
fromFile = '', fromFile = '',
compiling = '', compiling = '',
time = Date.now(); time = Date.now();
if (!grunt.option('verbose')) {
args.push('--log-level=info');
}
if (target === 'lessUpdated_Client') { if (target === 'lessUpdated_Client') {
fromFile = ['js', 'tpl', 'acpLess']; fromFile = ['js', 'tpl', 'acpLess'];
compiling = 'clientLess'; compiling = 'clientLess';
@ -37,11 +38,11 @@ module.exports = function(grunt) {
return incomplete.indexOf(ext) === -1; return incomplete.indexOf(ext) === -1;
}); });
args.push('--from-file=' + fromFile.join(',')); updateArgs.push('--from-file=' + fromFile.join(','));
incomplete.push(compiling); incomplete.push(compiling);
worker.kill(); worker.kill();
worker = fork('app.js', args, { env: env }); worker = fork('app.js', updateArgs, { env: env });
worker.on('message', function() { worker.on('message', function() {
if (incomplete.length) { if (incomplete.length) {
@ -101,6 +102,6 @@ module.exports = function(grunt) {
env.NODE_ENV = 'development'; env.NODE_ENV = 'development';
worker = fork('app.js', [], { env: env }); worker = fork('app.js', args, { env: env });
grunt.event.on('watch', update); grunt.event.on('watch', update);
}; };
Loading…
Cancel
Save