I have a directory structure as follows:
source/
libraries/
d3.js
lodash.js
//etc
I have grunt-copy setup as follows:
copy: {
main: {
files: [
{
src: ["source/libraries/*.js"],
dest: "build/",
flatten: true
}
I expect it to flatten the output into build, so that I will have
build/
d3.js
//etc
Instead, I get a reproduction of the original directory structure in build:
build/
source/
libraries/
d3.js
//etc
What gives? Am I not using flatten properly?
Well, if you're only using
flattenbecause you want everything insource/librariesto go intobuild, I would suggest actually using thecwd(current working directory) option instead. If, on the other hand, you actually have subfolders insource/librariesthen you probably want thatsrcline to besource/libraries/**/*.js.In any case, if you can use
cwdinstead it would look like this:For the other case, maybe this? (Notice the
expandoption set totrue)