For example, I have something like this:
if(ENV === 'production') {
grunt.registerTask('default', ['mkdir', 'copy', 'min']); // production
} else {
grunt.registerTask('default', ['mkdir', 'copy']); // dev
}
if I do ENV=development grunt
or grunt
, I want dev
task to be executed, and if I do ENV=production grunt
, i want production task to be executed.
I cannot register two tasks: default-dev
, default-prod
and run grunt default-dev
or grunt default-prod
.
I have to use ENV variable to specify which task to run.