grunt-hub
A Grunt task to watch and run tasks on multiple Grunt projects
Getting Started
Install this grunt plugin next to your project's
Gruntfile with: npm install grunt-hub
Then add this line to your project's Gruntfile:
grunt.loadNpmTasks('grunt-hub');
Documentation
This plugin includes a hub
task and overrides the watch
task.
hub
task
The hub task is for running tasks on multiple projects. It would like to know
which Gruntfiles to use and which tasks to run on each Grunt project. For example
if I would like to lint
and test
on every Grunt project one folder up:
grunt.initConfig({
hub: {
'lint test': ['../*/grunt.js'],
}
});
or using the more explicit syntax and only specifying certain Grunt projects:
grunt.initConfig({
hub: {
all: {
files: [
'../grunt-jam/grunt.js',
'../grunt-docs/grunt.js'
],
tasks: ['lint', 'test']
}
}
});
watch
task
The watch task is for watching multiple Grunt projects and triggering tasks on
the respective Grunt project as files are edited. This watch task will read each
project's Gruntfile and use each watch
config to determine which files to watch
and which tasks to run.
To specify which Gruntfiles this watch task should read use:
grunt.initConfig({
watch: '../*/grunt.js',
});
or if you're using the above hub
config, simply:
grunt.initConfig({
watch: '<config:hub.all.files>',
});
Contributing
Please open an issue or send a pull request. Thanks!
Release History
License
Copyright (c) 2012 Kyle Robinson Young
Licensed under the MIT license.