grunt-contrib-copy
grunt-contrib-copy copied to clipboard
Warning: Cannot read property 'cyan' of undefined
Install task, added configuration file
copy: {
js: {
expand: true,
files: [
{
src: 'public/build/main.js',
rename: function (dest, src) {
return dest;
}
}
]
},
css: {
}
}
After grunt run, getting
Running "copy:js" (copy) task
Warning: Cannot read property 'cyan' of undefined Use --force to continue.
Node 0.8.22, Windows 8
Forgot to add dest, not an issue.
@alexanderbeletsky , thx!
Just saw this today, it's kind of a weird error message, probably should tell you you're missing dest (I was using dst since that matches src)
Weirdest error message ever. I'm gonna reopen this to look into changing that.
Super wierd IMO too, just got it!
+1
+1 (also thanks for the comments)
fwiw, I just got this error (in grunt v0.4.5, node 0.10.32) during an exorcise task where I'd forgotten to update paths to reflect the paths used in other tasks. I'd venture to guess this erroneous error tends to show up in file/path not found situations.
+1
I also just got this error and thank god someone had written about it (I too forgot dest). As a newby dev I didn't think it was something in my source code that was causing the issue. Would love a clearer error message!
Hi,
I need to rename files at their source itself, and hence do not expect to specify a 'dest'. Also my files are specific ones in separate locations.
But it seems 'dest' must be specified. Can someone please help me out on how to specify dest to be same as whatever path from the array 'src' is processed currently; within grunt-contrib-copy.
I would appreciate this great help, as I am really stuck with plenty of trial-and-errors!! :'(
Updating with my task code:
copy: {
taskName: {
files: {
src: [
'./src/<folder a>/<file a.js>',
'./src/<folder a>/<file b.js>',
'./src/<folder b>/<file c.js>',
'./src/<folder c>/<folder c'>/<file d.js>',
'./src/<folder d>/<folder d'>/<folder d''>/<file e.js>'
],
rename: function(dest, src){
return src + "V" + parseInt(Math.random() * Math.pow(10, 10));
}
}
}
}
I need to place the renamed files in the same destination as its 'src'. Also, these specified files are not the only ones in the parent-folder. I do not want to apply this versioning to other files, except for the ones i mentioned.
Please help me out!