load-grunt-subtasks
Load multiple grunt tasks from subprojects using globbing patterns
Based on the wonderful load-grunt-tasks by Sindre Sorhus, but rather than loading all of the grunt tasks from the current module, it allows you to load other grunt tasks from inside of node_modules
.
Install
Install with npm: npm install --save-dev load-grunt-subtasks
Example config
By default, it will load all of the grunt-*
tasks within node_modules/*/node_modules
// Gruntfile.js module { // load all grunt-* tasks from within the `shared` module grunt; grunt; grunt;}
Usage examples
Load all grunt tasks
grunt;
Equivalent to:
grunt pattern: 'grunt-*';
Load all grunt-contrib tasks
grunt pattern: 'grunt-contrib-*';
Load all grunt-contrib tasks and another non-contrib task
grunt pattern: 'grunt-contrib-*' 'grunt-shell';
Load all grunt-contrib tasks excluding one
You can exclude tasks using the negate !
globbing pattern:
grunt pattern: 'grunt-contrib-*' '!grunt-contrib-coffee';
Set a specific base to search for grunt tasks
grunt base: './node_modules/shared/';
Set multiple bases to search for grunt tasks
grunt base: './node_modules/shared/' './node_modules/devDep';
All options in use
grunt pattern: 'grunt-contrib-*' 'lumbar' base: './node_modules/shared/';
Options
pattern
Type: String|Array
Default: 'grunt-*'
By default grunt-*
will be used as the globbing pattern.
base
Type: String|Array
Default: './node_modules/*/node_modules'
Note that base
will be searched for literally, and not globbed
License
MIT © Patrick Kettner