0
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?

raidendev
  • 2,729
  • 1
  • 22
  • 23
Ryan Printup
  • 456
  • 3
  • 9

1 Answers1

1

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.

raidendev
  • 2,729
  • 1
  • 22
  • 23
  • I avoided that because I do have development files that I don't want in production. Example: SASS and Coffeescript files that are compiled and put in production. – Ryan Printup Jul 18 '14 at 19:48
  • 1
    Just add ignore patterns to src, like `src: '**/*', '!**/.sass-cache/**'`. – raidendev Jul 19 '14 at 02:57