Was just wondering if it's possible to set the 'copy' task to do selective copies? Say, if one task wanted to target some files for copying, while another task may want to target others.
I see the 'main' is used in all the examples, but I can't find reference to if other names are able to be used, or another way to accomplish this, outside of using grunt-multi-dest
copy: {
main: {
files: [
{
cwd: 'src_static/img/',
src: ['**'],
dest: '../mainProject/assets/img/'
}
],
onlyIcons: {
files: [
{
cwd: 'src_static/img/icons/',
src: ['**'],
dest: '../mainProject/assets/img/icons/'
}
],
}
}
grunt.registerTask('copy-all', ['copy']);
grunt.registerTask('copy-icons', ['copy:onlyIcons']);
Although closed, I was asked to reference the question I posted as an issue on the grunt-contrib-copy site: https://github.com/gruntjs/grunt-contrib-copy/issues/230#issuecomment-96467261
Thanks. -Keith
For anyone coming across this now, this actually works:
grunt.registerTask('copy-all', ['copy']);
grunt.registerTask('copy-icons', ['copy:onlyIcons']);
This is going off of KDCinfo's initial Gruntfile config:
copy: {
main: {
files: [{
cwd: 'src_static/img/',
src: ['**'],
dest: '../mainProject/assets/img/'
}]
},
onlyIcons: {
files: [{
cwd: 'src_static/img/icons/',
src: ['**'],
dest: '../mainProject/assets/img/icons/'
}],
}
}
and shows that the copy.main
and copy.onlyIcons
must be called as copy:main
and copy:onlyIcons
within grunt.registerTask()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With