4
当定义在Gruntjs多任务,我做grunt.registerTask
当我能够做到咕噜this.files非多任务
grunt.registerMultiTask("taskName", "taskDescription", function() {
this.files.forEach(function (mapping) {
// mapping.src and mapping.dest are defined here,
// no matter which format was used to configure files in the task
});
});
为什么this.files
不可用?或者,当它不是多任务(紧凑格式,对象格式,阵列格式,定义为here)时,我不允许在任务配置中使用不同的文件格式?
当不在多任务内时,访问src和目标文件映射的最简单方法是什么?我想要做的
grunt.initConfig({
my_task: {
// I don't want to define a target here
files: {
// I want to be able to use any format here
"my/target/folder": "my/src/files/*"
}
}
grunt.registerTask("my_task", "description", function() {
this.files // ==> undefined
});