我怎么能忽略文件?我想在任何子目录中排除以_开头的所有文件。我对这两种方法没有成功:
this.fs.copyTpl(
this.templatePath('basicFiles/'),
this.destinationPath(''),
answers,
{ignore:"_*.*"}
);
this.fs.copyTpl(
[!*.*,this.templatePath('basicFiles/')],
this.destinationPath(''),
answers
);
更通用的是,想将每个basic / _exmaple.json合并(深层复制)到additionalConfig / example.json到desitnationPaht / exmaple.json(merged)。
欢迎任何想法:)。
对于fs.copyTpl
,你的{ignore:"_*.*"}
需要在第5个参数对象(如syntax所说)和globOptions
键内:
this.fs.copyTpl(
this.templatePath('**/*'), // from
this.destinationRoot(), // to
{}, // context // not here
{}, // templateOptions // not here
{ globOptions: {ignore:"_*.*"} } // < but here
)
{dot: true}
和其他类似选项也是如此。