Set up Grunt

Fixing up Grunt file to watch for directories

Exclude node modules folder from Jekyll built site
This commit is contained in:
Tetsuro
2015-07-25 13:48:45 -04:00
parent ae3d14bef5
commit 82249c99b3
2143 changed files with 389848 additions and 26 deletions
+59
View File
@@ -0,0 +1,59 @@
'use strict';
var os = require('os');
var padStdio = require('pad-stdio');
var async = require('async');
var cpCache = [];
module.exports = function (grunt) {
grunt.registerMultiTask('concurrent', 'Run grunt tasks concurrently', function () {
var spawnOptions;
var cb = this.async();
var options = this.options({
limit: Math.max((os.cpus().length || 1) * 2, 2)
});
// Set the tasks based on the config format
var tasks = this.data.tasks || this.data;
// Warning if there are too many tasks to execute within the given limit
if (options.limit < tasks.length) {
grunt.log.oklns(
'Warning: There are more tasks than your concurrency limit. After ' +
'this limit is reached no further tasks will be run until the ' +
'current tasks are completed. You can adjust the limit in the ' +
'concurrent task options'
);
}
// Optionally log the task output
if (options.logConcurrentOutput) {
spawnOptions = { stdio: 'inherit' };
}
padStdio.stdout(' ');
async.eachLimit(tasks, options.limit, function (task, next) {
var cp = grunt.util.spawn({
grunt: true,
args: [task].concat(grunt.option.flags()),
opts: spawnOptions
}, function (err, result, code) {
if (err || code > 0) {
grunt.warn(result.stderr || result.stdout);
}
grunt.log.writeln('\n' + result.stdout);
next();
});
cpCache.push(cp);
}, function () {
padStdio.stdout();
cb();
});
});
};
// make sure all child processes are killed when grunt exits
process.on('exit', function () {
cpCache.forEach(function (el) {
el.kill();
});
});