Here is an example of my Gruntfile.js:
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
grunt.config.set('targ', grunt.option('target'));
cachebuster: {
build: {
options: {
basedir: 'WebContent',
formatter: function(hashes) {
var json = {};
for (var filename in hashes) {
json["/" + filename] = hashes[filename];
}
return JSON.stringify(json);
}
},
src: [ 'WebContent/assets/**/*.js', 'WebContent/assets/**/*.css' ],
dest: 'src/main/resources/cachebusters.json'
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-cachebuster');
// Default task.
grunt.registerTask('default', ['cachebuster']);
};
I am looking to change the destination based on a command line argument of dev or deploy.
For example, if the command line argument is dev, then the destination should be 'cachebuster.json'. If the command line argument is deploy, then the destination should be 'src/main/resources/cachebuster.json'.
How can I accomplish this?