1 | # grunt-contrib-copy [](http://travis-ci.org/gruntjs/grunt-contrib-copy) |
---|
2 | |
---|
3 | > Copy files and folders. |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | ## Getting Started |
---|
8 | This plugin requires Grunt `~0.4.0` |
---|
9 | |
---|
10 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: |
---|
11 | |
---|
12 | ```shell |
---|
13 | npm install grunt-contrib-copy --save-dev |
---|
14 | ``` |
---|
15 | |
---|
16 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: |
---|
17 | |
---|
18 | ```js |
---|
19 | grunt.loadNpmTasks('grunt-contrib-copy'); |
---|
20 | ``` |
---|
21 | |
---|
22 | *This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-copy/tree/grunt-0.3-stable).* |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | ## Copy task |
---|
27 | _Run this task with the `grunt copy` command._ |
---|
28 | |
---|
29 | Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. |
---|
30 | ### Options |
---|
31 | |
---|
32 | #### processContent |
---|
33 | Type: `Function(content, srcpath)` |
---|
34 | |
---|
35 | This option is passed to `grunt.file.copy` as an advanced way to control the file contents that are copied. |
---|
36 | |
---|
37 | #### processContentExclude |
---|
38 | Type: `String` |
---|
39 | |
---|
40 | This option is passed to `grunt.file.copy` as an advanced way to control which file contents are processed. |
---|
41 | |
---|
42 | ### Usage Examples |
---|
43 | |
---|
44 | ```js |
---|
45 | copy: { |
---|
46 | main: { |
---|
47 | files: [ |
---|
48 | {src: ['path/*'], dest: 'dest/', filter: 'isFile'}, // includes files in path |
---|
49 | {src: ['path/**'], dest: 'dest/'}, // includes files in path and its subdirs |
---|
50 | {expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'}, // makes all src relative to cwd |
---|
51 | {expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'} // flattens results to a single level |
---|
52 | ] |
---|
53 | } |
---|
54 | } |
---|
55 | ``` |
---|
56 | |
---|
57 | |
---|
58 | ## Release History |
---|
59 | |
---|
60 | * 2013-02-14âââv0.4.0âââFirst official release for Grunt 0.4.0. |
---|
61 | * 2013-01-22âââv0.4.0rc7âââUpdating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. |
---|
62 | * 2013-01-13âââv0.4.0rc5âââUpdating to work with grunt v0.4.0rc5. Conversion to grunt v0.4 conventions. Replace basePath with cwd. Empty directory support. |
---|
63 | * 2012-10-17âââv0.3.2âââPass copyOptions on single file copy. |
---|
64 | * 2012-10-11âââv0.3.1âââRename grunt-contrib-lib dep to grunt-lib-contrib. |
---|
65 | * 2012-09-23âââv0.3.0âââGeneral cleanup and consolidation. Global options depreciated. |
---|
66 | * 2012-09-17âââv0.2.4âââNo valid source check. |
---|
67 | * 2012-09-16âââv0.2.3âââPath.sep fallback for node <= 0.7.9. |
---|
68 | * 2012-09-16âââv0.2.2âââSingle file copy support. Test refactoring. |
---|
69 | * 2012-09-06âââv0.2.0âââRefactored from grunt-contrib into individual repo. |
---|
70 | |
---|
71 | --- |
---|
72 | |
---|
73 | Task submitted by [Chris Talkington](http://christalkington.com/) |
---|
74 | |
---|
75 | *This file was generated on Fri Feb 22 2013 09:26:58.* |
---|