gruntjsgrunt-contrib-copy

Grunt copy format


Take for example these two grunt configs:

copy: {
    dist: {
        files: [
            ...
        ]
    }
}

and

copy: {
    dist: {
        ...
        }
    }
}

"copy" is my task, "dist" is my target, but what is "files"? Seems to work all the same with or without it.


Solution

  • Yes, it works all the same with or without "files". This property provides you the possibility of do different operations in different folders.

    For example, in the documentation, you can see that files maps and process different folders with different methods and filters.

    If you do not add the "files" property, all your main copy is in one folder. For example:

    copy: {
      main: {
       src: 'src/*',
       dest: 'dest/',
      },
     },
    

    You are not be able to map different folders in src, it only copies all the src folder in dest folder.