mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-01 00:08:53 +02:00
if multiple file extensions change before nodebb finishes compiling, then add to incomplete list and compile
This commit is contained in:
38
Gruntfile.js
38
Gruntfile.js
@@ -34,30 +34,42 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.registerTask('default', ['watch']);
|
||||
|
||||
worker = fork('app.js', [], {
|
||||
env: env,
|
||||
silent: false
|
||||
});
|
||||
|
||||
|
||||
worker = fork('app.js', [], { env: env });
|
||||
|
||||
var incomplete = [];
|
||||
|
||||
grunt.event.on('watch', function(action, filepath, target) {
|
||||
var args = [];
|
||||
var args = ['--log-level=info'],
|
||||
fromFile = '',
|
||||
compiling = '';
|
||||
|
||||
if (target === 'lessUpdated') {
|
||||
args.push('--from-file=js,tpl');
|
||||
fromFile = ['js','tpl'];
|
||||
compiling = 'less';
|
||||
} else if (target === 'clientUpdated') {
|
||||
args.push('--from-file=less,tpl');
|
||||
fromFile = ['less','tpl'];
|
||||
compiling = 'js';
|
||||
} else if (target === 'templatesUpdated') {
|
||||
args.push('--from-file=js,less');
|
||||
fromFile = ['js','less'];
|
||||
compiling = 'tpl';
|
||||
} else if (target === 'serverUpdated') {
|
||||
args.push('--from-file=less,js,tpl');
|
||||
fromFile = ['less','js','tpl'];
|
||||
}
|
||||
|
||||
args.push('--log-level=info');
|
||||
fromFile = fromFile.filter(function(ext) {
|
||||
return incomplete.indexOf(ext) === -1;
|
||||
});
|
||||
|
||||
args.push('--from-file=' + fromFile.join(','));
|
||||
incomplete.push(compiling);
|
||||
|
||||
worker.kill();
|
||||
worker = fork('app.js', args, {
|
||||
env: env,
|
||||
silent: false
|
||||
worker = fork('app.js', args, { env: env });
|
||||
|
||||
worker.on('message', function() {
|
||||
incomplete = [];
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user