mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 08:20:36 +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: {
|
options: {
|
||||||
script: 'app.js',
|
script: 'app.js',
|
||||||
node_env: 'development',
|
node_env: 'development',
|
||||||
args: ['dev', 'from-file'],
|
args: ['--log-level=info'],
|
||||||
output: "NodeBB Ready",
|
output: 'NodeBB Ready',
|
||||||
interrupt: true,
|
interrupt: true,
|
||||||
spawn: false,
|
spawn: false,
|
||||||
interval: 100
|
interval: 100
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
minifyJS: {
|
serverUpdated: {
|
||||||
options: {
|
options: {
|
||||||
script: 'app.js',
|
script: 'app.js',
|
||||||
node_env: 'development',
|
node_env: 'development',
|
||||||
args: ['dev', 'minify-js'],
|
args: ['--from-file=less,js', '--log-level=info'],
|
||||||
output: "NodeBB Ready",
|
output: 'NodeBB Ready',
|
||||||
interrupt: true,
|
interrupt: true,
|
||||||
spawn: false,
|
spawn: false,
|
||||||
interval: 100
|
interval: 100
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
compileLESS: {
|
clientUpdated: {
|
||||||
options: {
|
options: {
|
||||||
script: 'app.js',
|
script: 'app.js',
|
||||||
node_env: 'development',
|
node_env: 'development',
|
||||||
args: ['dev', 'compile-less'],
|
args: ['--from-file=less', '--log-level=info'],
|
||||||
output: "NodeBB Ready",
|
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,
|
interrupt: true,
|
||||||
spawn: false,
|
spawn: false,
|
||||||
interval: 100
|
interval: 100
|
||||||
@@ -39,17 +50,22 @@ module.exports = function(grunt) {
|
|||||||
less: {
|
less: {
|
||||||
development: {
|
development: {
|
||||||
files: {
|
files: {
|
||||||
"public/bin/manifest.css": "source/manifest.less"
|
'public/bin/manifest.css': 'source/manifest.less'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
compileLESS: {
|
lessUpdated: {
|
||||||
files: "**/*.less",
|
files: 'public/**/*.less',
|
||||||
tasks: ['express:compileLESS'],
|
tasks: ['express:lessUpdated']
|
||||||
options: {
|
},
|
||||||
livereload: true,
|
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.loadNpmTasks('grunt-express-server');
|
||||||
|
|
||||||
grunt.registerTask('default', ['express:dev', 'watch']);
|
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();
|
var date = new Date();
|
||||||
return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
|
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') {
|
if(os.platform() === 'linux') {
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ if(nconf.get('ssl')) {
|
|||||||
// Preparation dependent on plugins
|
// Preparation dependent on plugins
|
||||||
plugins.ready(function() {
|
plugins.ready(function() {
|
||||||
async.parallel([
|
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('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.css.minify : meta.css.getFromFile),
|
||||||
async.apply(meta.sounds.init)
|
async.apply(meta.sounds.init)
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user