gruntjsgrunt-contrib-copy

Copy one file to multiple folders with grunt


Is it possible to copy one file to multiple directories with Grunt? ie :

expand: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.app %>/client/*',
src: 'core/index.html'

Where the * is all the subfolders inside the clients folder.

Thank you!


Solution

  • It's not possible with *, you have to map any folder using files option. You do not need the expand option in this case:

    files: [
      { src: 'core/index.html' dest: '<%= yeoman.app %>/folder1' },
      { src: 'core/index.html: '<%= yeoman.app %>/folder2' },
      { src: 'core/index.html' <%= yeoman.app %>: 'dest/folder3' },
    ]