mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
nice, I figured out how to speed up grunt watch
This commit is contained in:
50
Gruntfile.js
50
Gruntfile.js
@@ -6,30 +6,41 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
script: 'app.js',
|
||||
node_env: 'development',
|
||||
args: ['dev', 'from-file'],
|
||||
output: "NodeBB Ready",
|
||||
args: ['--log-level=info'],
|
||||
output: 'NodeBB Ready',
|
||||
interrupt: true,
|
||||
spawn: false,
|
||||
interval: 100
|
||||
}
|
||||
},
|
||||
minifyJS: {
|
||||
serverUpdated: {
|
||||
options: {
|
||||
script: 'app.js',
|
||||
node_env: 'development',
|
||||
args: ['dev', 'minify-js'],
|
||||
output: "NodeBB Ready",
|
||||
args: ['--from-file=less,js', '--log-level=info'],
|
||||
output: 'NodeBB Ready',
|
||||
interrupt: true,
|
||||
spawn: false,
|
||||
interval: 100
|
||||
}
|
||||
},
|
||||
compileLESS: {
|
||||
clientUpdated: {
|
||||
options: {
|
||||
script: 'app.js',
|
||||
node_env: 'development',
|
||||
args: ['dev', 'compile-less'],
|
||||
output: "NodeBB Ready",
|
||||
args: ['--from-file=less', '--log-level=info'],
|
||||
output: 'NodeBB Ready',
|
||||
interrupt: true,
|
||||
spawn: false,
|
||||
interval: 100
|
||||
}
|
||||
},
|
||||
lessUpdated: {
|
||||
options: {
|
||||
script: 'app.js',
|
||||
node_env: 'development',
|
||||
args: ['--from-file=js', '--log-level=info'],
|
||||
output: 'NodeBB Ready',
|
||||
interrupt: true,
|
||||
spawn: false,
|
||||
interval: 100
|
||||
@@ -39,17 +50,22 @@ module.exports = function(grunt) {
|
||||
less: {
|
||||
development: {
|
||||
files: {
|
||||
"public/bin/manifest.css": "source/manifest.less"
|
||||
'public/bin/manifest.css': 'source/manifest.less'
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
compileLESS: {
|
||||
files: "**/*.less",
|
||||
tasks: ['express:compileLESS'],
|
||||
options: {
|
||||
livereload: true,
|
||||
}
|
||||
lessUpdated: {
|
||||
files: 'public/**/*.less',
|
||||
tasks: ['express:lessUpdated']
|
||||
},
|
||||
clientUpdated: {
|
||||
files: 'public/src/**/*.js',
|
||||
tasks: ['express:clientUpdated']
|
||||
},
|
||||
serverUpdated: {
|
||||
files: ['*.js', 'src/**/*.js'],
|
||||
tasks: ['express:serverUpdated']
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -58,8 +74,4 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-express-server');
|
||||
|
||||
grunt.registerTask('default', ['express:dev', 'watch']);
|
||||
|
||||
grunt.event.on('watch', function(action, filepath, target) {
|
||||
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
|
||||
});
|
||||
};
|
||||
2
app.js
2
app.js
@@ -43,7 +43,7 @@ winston.add(winston.transports.Console, {
|
||||
var date = new Date();
|
||||
return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
|
||||
},
|
||||
level: global.env === 'production' ? 'info' : 'verbose'
|
||||
level: (global.env === 'production' || nconf.get('log-level') === 'info') ? 'info' : 'verbose'
|
||||
});
|
||||
|
||||
if(os.platform() === 'linux') {
|
||||
|
||||
@@ -39,8 +39,8 @@ if(nconf.get('ssl')) {
|
||||
// Preparation dependent on plugins
|
||||
plugins.ready(function() {
|
||||
async.parallel([
|
||||
async.apply((!nconf.get('minify-js') && !nconf.get('from-file')) ? meta.js.minify : meta.js.getFromFile, app.enabled('minification')),
|
||||
async.apply((!nconf.get('compile-less') && !nconf.get('from-file')) ? meta.css.minify : meta.css.getFromFile),
|
||||
async.apply(!nconf.get('from-file') ? meta.js.minify : meta.js.getFromFile, app.enabled('minification')),
|
||||
async.apply(!nconf.get('from-file') ? meta.css.minify : meta.css.getFromFile),
|
||||
async.apply(meta.sounds.init)
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user