Skip to content

Node.js based forum software built for the modern web

nice, I figured out how to speed up grunt watch

psychobunnyeb6754c5ebad
diff --git a/Gruntfile.js b/Gruntfile.js
index eb57d4984e..edae80b7d8 100644
--- a/Gruntfile.js
+++ b/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);
- });
};
\ No newline at end of file
diff --git a/app.js b/app.js
index f208072719..ef113e5ece 100644
--- a/app.js
+++ b/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') {
diff --git a/src/webserver.js b/src/webserver.js
index 5512c84e40..01dee2b91c 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -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)
]);
});