ottz0
ottz0

Reputation: 2605

Setting similar values in Grunt

I am using grunt-contrib-copy and have the same values for each object in my array.

How can I make it where I dont have to type nonull: true, expand: true, cwd: 'src' on every object?

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

Upvotes: 0

Views: 18

Answers (1)

suzumakes
suzumakes

Reputation: 770

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

As long as you're specifying one destination (or directory and pulling in nested folders) you can do it like this.

EDIT: nonull defaults to true so you don't have to specify it.

Upvotes: 1

Related Questions