Copy files and folders. Forked from grunt-contrib-copy 0.4.1
Copy files and folders.
If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:
npm install grunt-contrib-copy --save-dev
Run this task with the
grunt copy command.
This task is a [multi task] so any targets, files and options should be specified according to the [multi task] documentation. [multi task]: https://github.com/gruntjs/grunt/wiki/Configuring-tasks
This task will preserve the modification timestamp of the original file.
This option sets the current working directory for use with the minimatch and copy process. This helps translate paths when copied so that the destination stucture matches the source structure exactly. Without a
cwd set, all paths are relative to the gruntfile directory which can cause extra depth to be added to your copied structure when it may not be desired.
When copying to a directory you must add a trailing slash to the destination due to added support of single file copy.
copy:target:options:cwd: 'path/to/sources'files:'tmp/test/': '*' 'sub1/*'
This option excludes empty folders from being copied to the destination directory.
This option performs a flat copy that dumps all the files into the root of the destination directory, overwriting files if they exist.
This option accepts a function that adjusts the filename of the copied file. Function is passed filename and should return a string.
options:if filename == "test.jpg"filename = "newname.jpg";return filename;
This option is passed to
grunt.file.copy as an advanced way to control the file contents that are copied.
This option is passed to
grunt.file.copy as an advanced way to control which file contents are processed.
Type: 'String' | 'Function'
Controls whether or not the file will be copied.
onlyIf is a function, is should have the signature:
fn(srcPath, destPath, srcStat, destStat)
onlyIf is a string, then it must be one of:
onlyIfis not provided
These options will be forwarded on to expandFiles, as referenced in the minimatch options section
copy:dist:files:"path/to/directory/": "path/to/source/*" // includes files in dir"path/to/directory/": "path/to/source/**" // includes files in dir and subdirs"path/to/project-<%= pkg.version %>/": "path/to/source/**" // variables in destination"path/to/directory/": "path/to/sources/*.js" "path/to/more/*.js" // include JS files in two diff dirs"path/to/filename.ext": "path/to/source.ext"
Task submitted by Chris Talkington
This file was generated on Thu Nov 29 2012 20:23:02.