Skip to content

Instantly share code, notes, and snippets.

@ksummerlin
Created November 25, 2013 15:20
Show Gist options
  • Save ksummerlin/7642876 to your computer and use it in GitHub Desktop.
Save ksummerlin/7642876 to your computer and use it in GitHub Desktop.
Runs all grunt files in sub-folders.
// Run sub-grunt files
grunt.registerMultiTask('subgrunt', 'Run a sub-gruntfile.', function () {
var path = require('path');
grunt.util.async.forEachSeries(this.filesSrc, function (gruntfile, next) {
grunt.util.spawn({
grunt: true,
args: ['--gruntfile', path.resolve(gruntfile)].concat(grunt.option.flags()),
}, function (error, result) {
if (error) {
grunt.log.error(result.stdout).writeln();
next(new Error('Error running sub-gruntfile "' + gruntfile + '".'));
} else {
grunt.verbose.ok(result.stdout);
next();
}
});
}, this.async());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment