Inventory of solutions to modularize grunt configuration for large project & (legacy) codebases
- https://gist.github.com/Integralist/7463783
- see the oncletom's response below
https://github.com/oztu/grunt-modules
Grunt Modules allows you to split up your grunt file into modular pieces. It's useful for managing very large codebases (if you have to have one).
In Grunt you define pieces of your modules within each multitask. Grunt Modules inverts the configuration so that you can have your module define it's tasks instead, allowing you to put entire cross-sections of your configuration in their own files.
https://github.com/codeactual/grunt-horde
Packageable grunt configuration modules
- Separate files define values for initConfig, loadNpmTask, etc.
- Store modules in regular directories or leverage NPM, ex. npm install git://.
- Compose configuration from multiple modules w/ recursive merging, cascading, etc.
https://github.com/endel/grunt-loader
A modular approach for grunt configuration. Configure each of your plugins using YAML files, and don't ever touch your Gruntfile.js.
https://github.com/firstandthird/load-grunt-config
Split the gruntfile into tasks.
- Each task has its own config file. Example: jshint.js, mocha.js, etc.
- Auto load all grunt plugins. Uses load-grunt-tasks.
- Auto expose package.json (<%= package.name %>).
- Support for YAML files.
- Support for coffeescript files.
- Support for returning a function.
- Easily register task aliases with aliases.(js|yaml|coffee).
Example of file layout :
├── Gruntfile.js
├── grunt-tasks
│ ├── options <= config directory
│ │ ├── imagemin.js <= config file for the imagemin task
│ │ ├── notify.js
│ │ └── watch.js
│ ├── set_config.js <= custom task
│ └── set_global.js <= another custom task
Don't forget that several gruntfiles can live in various levels of your file structure...
Clever tricks (and an entry point to discover Grunt's API) : https://oncletom.io/2013/dynamic-grunt-targets-using-templates/
from @oncletom : https://twitter.com/oncletom/status/402737171045838848 :
" faire un module npm par task, et tu peux utiliser grunt.util._.merge
+ initConfig
"
Et par exemple dans
./src/grunt/configure/less
:Plus DIY.