grunt-contrib-copy
grunt-contrib-copy copied to clipboard
Copy files from one directory to root of project
I'm trying to copy a set of files from a subfolder of the project to the root of the project, with no luck. I tried to set the dest attribute to . or .. or ./ or ../ with no luck. I manage to accomplish what I wanted with a workaround, but it has to be a better way than this?
copy : {
dist_files : {
expand : true,
flatten : true,
src : 'js/app/dist/*',
dest : '../../../',
rename : function(dest, src){
return __dirname + "\\" + src.replace('123-loader', 'loader');
}
}
}
dest: '' worked for me - give that a go?
@phun-ky have you tried to use the cwd option ?
You could do
copy : {
dist_files : {
expand : true,
cwd : 'js/app/dist',
src: ['*'],
dest : '../../../'
}
}
By the way, I'm not sure you said everything about your use case. I don't understand the need for the rename option.
@furzeface thank you for your answer,I am puzzled all thie morning,I try dest:'/' and dest:'../' with failure.the correct way is dest:''.