0

我正在使用grunt-contrib-copy并且对数组中的每个对象都具有相同的值。

我怎样才能使它不必nonull: true, expand: true, cwd: 'src'在每个对象上键入?

copy:{
      dist:{
        files: [
          {nonull: true, expand: true, cwd: 'src', src: 'index.html', dest: 'dist'},
          {nonull: true, expand: true, cwd: 'src', src: 'eanapi/**', dest: 'dist'},
        ],
      },  
    },
4

1 回答 1

1
    // copy files
    copy: {
        img: {
            files: [{
                expand: true,
                cwd: 'src/img/',
                src: [
                    'foo/*.{png,jpg}',
                    'foo/*.{png,jpg}',
                    'foo/*.{png,jpg}',
                ],
                dest: 'img/'
            }],
        },
    },

只要您指定一个目标(或目录并拉入嵌套文件夹),您就可以这样做。

编辑: nonull 默认为 true,因此您不必指定它。

于 2016-02-23T13:49:11.540 回答