Grunt - Copy files to multiple destinations
JavaScript
// Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
main: {
files: [
{
cwd: 'src/',
expand: true,
src: ['**'],
dest: 'dest1/'
},
{
cwd: 'src/',
expand: true,
src: ['**'],
dest: 'dest2/'
}]
}
},
watch: {
files: ['src/*.js'],
tasks: ['copy']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['watch']);
};
// package.json
{
"name": "grunt-test",
"version": "0.0.1",
"description": "Testing moving in Grunt",
"main": "Gruntfile.js",
"scripts": {
"test": "test"
},
"author": "me",
"license": "BSD-2-Clause",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-copy": "~0.4.1"
}
}