2017-04-25 33 views
2

我該如何忽略文件?我想排除在任何子目錄中以_開頭的所有文件。我有這兩種方法沒有成功:Yeoman忽略fs.copyTpl的文件

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

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

比較一般,想合併(深層副本)的每個基本/ _exmaple.json到additionalConfig/example.json到desitnationPaht/exmaple.json(合併)。

每個想法都歡迎:)。

回答

0

對於fs.copyTpl{ignore:"_*.*"}需求是在參數對象(如syntax說)和內globOptions鍵:

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

同爲{dot: true}等這樣的選項。