0
我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']);
};
我想基于dev的改变dest的位置或部署命令行参数..
即,如果命令行arg是dev的则dest:“cachebuster.json” 如果命令行参数是部署然后dest:'src/main/resources/cachebuster.json'
我该如何做到这一点?
谢谢。您描述的在目标间共享选项的第二种方法效果很好。 –