jonschlinkert / copy

Copy files using glob patterns. Sync, async, promise or streams. (node.js utility)
MIT License
94 stars 125 forks source link

Recurcively creates directories copying single file #18

Open shrimpwagon opened 7 years ago

shrimpwagon commented 7 years ago
copy.one("public/assets/tmp/font-awesome-4.7.0/css/font-awesome.min.css", "public/assets/css");

This ends up creating the folders

public/assets/tmp/font-awesome-4.7.0/css

inside of:

public/assets/css

I just want to put the file into this directory without all the other dirs.

jonschlinkert commented 7 years ago

try passing an options object with {flatten: true} after the dest. Also, make sure you add a callback so you're notified of any errors:

(I usually try to commit first before doing new copy operations, might be a good idea here)

var src = "public/assets/tmp/font-awesome-4.7.0/css/font-awesome.min.css",
copy.one(src, "public/assets/css", {flatten: true}, function(err) {
  if (err) return console.log(err);
});
sandervm commented 7 years ago

Thanks! This is what I was looking for, maybe a suggestion to mention the possible settings of options in the documentation. I couldn't find them there!

Prophet32j commented 7 years ago

This is what I was looking for here, too. Updating to include what to pass as options would help. I was about to dig into the source to find if this was possible

jonschlinkert commented 7 years ago

Updating to include what to pass as options would help. I was about to dig into the source to find if this was possible

I'll make a note on the readme! thanks for the tip.

I'll keep this open as a reminder...

PetersonLian commented 7 years ago

Helped me too.