Skip to content

Instantly share code, notes, and snippets.

@szimmers
Created October 22, 2013 14:30
Show Gist options
  • Save szimmers/7101729 to your computer and use it in GitHub Desktop.
Save szimmers/7101729 to your computer and use it in GitHub Desktop.
example grunt file for running tasks in subdirectories, each which have their own grunt file
module.exports = function(grunt) {
grunt.registerTask('buildapp', function(dir) {
var done = this.async();
grunt.log.writeln('processing ' + dir);
grunt.util.spawn({
grunt: true,
args:['jshint', 'build', 'test', 'deploy'],
opts: {
cwd: dir
}
},
function(err, result, code) {
if (err == null) {
grunt.log.writeln('processed ' + dir);
done();
}
else {
grunt.log.writeln('processing ' + dir + ' failed: ' + code);
done(false);
}
})
});
grunt.registerTask('build', function() {
grunt.task.run(['buildapp:apps/framework']);
grunt.task.run(['buildapp:apps/foo']);
});
grunt.registerTask('default', ['build']);
};
{
"name": "foosuite",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9"
},
"engines": {
"node": ">=0.8.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment