I'm working on writing a grunt plugin that will help with a build process I use quite frequently. What I usually end up doing is copying/pasting my GruntFile from project to project, but I think it might be a bit more useful putting it into a plugin. The tasks that I use for this build process are usually grunt tasks such as jshint, copy, cssmin, less, and uglify amongst others. I think I could clean up my Gruntfile.js file a ton if I could create a plugin that just took in some configuration and ran all of those tasks.
My current setup is usually something like this:
grunt.initConfig({
jshint: {/* ... */},
copy: {/* ... */},
less: {/* ... */},
cssmin: {/* ... */},
uglify: {/* ... */}
});
// Load and Register tasks...
but I would like to reduce the initConfig to something like this:
grunt.initConfig({
build: {
dev: {
paths: {
public: 'public',
source: 'source',
bower: 'bower_components'
},
options: {
pretty: true,
minify: false
}
}
}
});
Is this something that can be done from within a grunt plugin?
EDIT: I found something similar to what I was looking for, but it doesn't seem all that elegant, especially with all of the configurations I'll need to manually setup, but maybe it's worth it.