You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodebb/Gruntfile.js

61 lines
1.2 KiB
JavaScript

10 years ago
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
files: {
'public/bin/manifest.css': 'source/manifest.less'
10 years ago
}
}
},
watch: {
lessUpdated: {
files: 'public/**/*.less',
/*tasks: ['express:lessUpdated']*/
},
clientUpdated: {
files: 'public/src/**/*.js',
/*tasks: ['express:clientUpdated']*/
},
serverUpdated: {
files: ['*.js', 'src/**/*.js'],
/*tasks: ['express:serverUpdated']*/
10 years ago
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['watch']);
var fork = require('child_process').fork,
env = process.env;
process.env.NODE_ENV = 'development'
var worker = fork('app.js', ['--log-level=info'], {
env: env,
silent: true
});
grunt.event.on('watch', function(action, filepath, target) {
var args = [];
if (target === 'lessUpdated') {
args.push('--from-file=js');
} else if (target === 'clientUpdated') {
args.push('--from-file=less');
} else if (target === 'serverUpdated') {
args.push('--from-file=less,js');
}
args.push('--log-level=info');
worker.kill();
worker = fork('app.js', args, {
env: env,
silent: true
});
});
10 years ago
};