try #2 (I give up, grunt-watch seems so unpredictable... on windows anyways)

v1.18.x
psychobunny 10 years ago
parent 02c310ea03
commit 540facaaab

@ -1,53 +1,56 @@
module.exports = function(grunt) { module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
execute: { express: {
dev: { dev: {
src: 'a.js',
options: { options: {
args: ['arg'] script: 'app.js',
node_env: 'development',
args: ['dev', 'from-file'],
output: "NodeBB Ready"
} }
}, },
minifyJS: { minifyJS: {
src: 'app.js',
options: { options: {
args: ['from-file'] script: 'app.js',
node_env: 'development',
args: ['dev', 'minify-js'],
output: "NodeBB Ready"
} }
}, },
minifyCSS: { compileLESS: {
src: 'app.js',
options: { options: {
args: ['from-file'] script: 'app.js',
node_env: 'development',
args: ['dev', 'compile-less'],
output: "NodeBB Ready"
} }
}, }
}, },
watch: { less: {
clientScripts: { development: {
files: ['public/src/**/*.js'], files: {
tasks: ['execute:minifyJS'], "public/bin/manifest.css": "source/manifest.less"
options: {
spawn: false
}
},
serverScripts: {
files: ['*.js', 'src/**/*.js', 'node_modules/**/*.js'],
tasks: ['execute:minifyCSS'],
options: {
spawn: false
} }
}, }
less: { },
files: ['**/*.less'], watch: {
tasks: ['execute:minifyCSS'], compileLESS: {
files: "**/*.less",
tasks: ['express:compileLESS'],
options: { options: {
spawn: false livereload: true,
} }
} }
} }
}); });
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-execute'); grunt.loadNpmTasks('grunt-express-server');
grunt.registerTask('default', ['express:dev', 'watch']);
grunt.registerTask('default', ['watch', 'execute:minifyCSS']); grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
}; };

@ -13,6 +13,7 @@ process.on('message', function(msg) {
} }
}); });
function hashPassword(password, rounds) { function hashPassword(password, rounds) {
async.waterfall([ async.waterfall([
function(next) { function(next) {

@ -71,7 +71,9 @@
"mocha": "~1.13.0", "mocha": "~1.13.0",
"grunt": "~0.4.5", "grunt": "~0.4.5",
"grunt-contrib-watch": "^0.6.1", "grunt-contrib-watch": "^0.6.1",
"grunt-execute": "^0.2.2" "grunt-execute": "^0.2.2",
"grunt-express-server": "^0.4.19",
"grunt-contrib-less": "^1.0.0"
}, },
"bugs": { "bugs": {
"url": "https://github.com/NodeBB/NodeBB/issues" "url": "https://github.com/NodeBB/NodeBB/issues"

@ -4,3 +4,20 @@
width:220px; width:220px;
} }
} }

@ -1,5 +1,6 @@
'use strict'; 'use strict';
if ('undefined' !== typeof window) { if ('undefined' !== typeof window) {
(function ($, undefined) { (function ($, undefined) {

@ -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('from-file') ? meta.js.minify : meta.js.getFromFile, app.enabled('minification')), 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.css.minify : meta.css.getFromFile), async.apply((!nconf.get('compile-less') && !nconf.get('from-file')) ? meta.css.minify : meta.css.getFromFile),
async.apply(meta.sounds.init) async.apply(meta.sounds.init)
]); ]);
}); });

Loading…
Cancel
Save