user3290988
user3290988

Reputation:

How to get grunt-contrib-copy to ignore folder

var developmentFolder = './Development/';
var productionFolder = './Production/';

copy: {
    main: {
        files: [
            {
                expand: true,
                cwd: developmentFolder,
                src: [developmentFolder + "*"],
                dest: productionFolder,
                filter: 'isFile'
            },
            {
                expand: true,
                cwd: developmentFolder,
                src: [
                    developmentFolder + 'lib/images/**',
                    developmentFolder + 'lib/php/**'
                ],
                dest: productionFolder
            }
        ]
    }
}

I currently have this code to copy files from a development folder to a production folder. Whenever I run this grunt copies the Development folder over and sticks it into the Production folder. So I end up with this.

Production
| - Development
| ----- lib
| ------- etc

I want the output to be

Production
| - lib
| --- etc

How can I achieve this?

Upvotes: 0

Views: 134

Answers (1)

raidendev
raidendev

Reputation: 2799

Your task can be simplified to:

copy: {
  main: {
    files: [
      {
        expand: true,
        cwd: 'Development/  ',
        src: '**/*',
        dest: 'Production/'
      }
    ]
  }
}

In result, all the contents of Development directory will be copied to Production directory.

Upvotes: 1

Related Questions