grunt-merge-copy
v1.0.1
Published
Merge two directories
Downloads
1,684
Readme
grunt-merge-copy
Description
Merge two or more directories. Files can be optionally filtered using a glob pattern.
Getting Started
This plugin requires Grunt ~0.4.0
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, you may install this plugin with this command:
npm install grunt-merge-copy --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-merge-copy');
Copy task
Run this task with the grunt merge-copy
command.
Task targets and options may be specified according to the grunt Configuring tasks guide.
Options
destination
Type: String
Specifies the destination directory of the merge operation.
directories
Type: Array
An array of directories that should me merged. Order is important!
encoding
Type: String
Default: grunt.file.defaultEncoding
The file encoding to copy files with.
patterns
Type: String | Array
Default: **/*
Optionally filter the files by one or more glob patterns.
globOptions
Type: Object
Default: { nonull: false, dot: true }
Optionally set some glob options.
Usage Examples
Assuming you have following project structure:
└── app
└── base
├── apple.html
├── berry.html
└── clientx
├── apple.html
├── banana.html
├── Gruntfile.js
Applying following merge-copy configuration:
'merge-copy': {
main: {
options: {
destination: 'dist',
directories: [ 'app/base/', 'app/clientx' ]
},
}
}
Result:
└── app
└── base
├── apple.html
├── berry.html
└── clientx
├── apple.html
├── banana.html
└── dist
├── apple.html ( file from clientx directory )
├── berry.html
├── banana.html
├── Gruntfile.js
Release History
1.0.0
- Implement tests to ensure that module has the correct behaviour in different situations;
- Split code to get better organization and to be testable.
0.2.0
- Added support for setting glob options.
0.1.0
- Defined merge-copy task using node-merge-collect-files.