How to ignore files in Yeoman with fs.copyTpl
Asked Answered
M

1

6

how can i ignore files? i want to exclude all file starting with _ in any subdirectory. i have no success with these two approaches:

this.fs.copyTpl(
   this.templatePath('basicFiles/'),
   this.destinationPath(''),
   answers,
   {ignore:"_*.*"}
);

this.fs.copyTpl(
  [!*.*,this.templatePath('basicFiles/')],
  this.destinationPath(''),
  answers
);

More general, would like to merge(deep copy) every basic/_exmaple.json into additionalConfig/example.json to desitnationPaht/exmaple.json (merged).

Every idea is welcome :).

Mezereum answered 25/4, 2017 at 23:12 Comment(0)
J
9

For fs.copyTpl your {ignore:"_*.*"} needs to be in the 5th argument object (as the syntax says) and inside globOptions key:

this.fs.copyTpl(
  this.templatePath('**/*'), // from
  this.destinationRoot(),    // to
  {},  // context            // not here
  {},  // templateOptions    // not here
  { globOptions: {ignore:"_*.*"} } // < but here
)

Same for {dot: true} and other such options.

Jadwigajae answered 6/9, 2017 at 20:24 Comment(2)
That is awesome.Pluto
You now need to give an array for ignore : { globOptions: {ignore: ["_*.*"]} } Baerman

© 2022 - 2024 — McMap. All rights reserved.