无需模板的 Yeoman 复制目录

Yeoman copy directory without templating

我正在使用 yeoman 为我的应用创建脚手架。

我想递归复制所有目录,这就是我使用 this.directory 方法的原因

this.directory('views/static/views', '.views/static/views');

现在,每当我 运行 时,它都会显示 <%= title %> in file index.html during copying is not defined.

的错误

<%= title %> 不是模板的一部分,但我将其用于我的其他目的。

我想在使用 this.directory 方法复制时禁用模板。?

我明白了。 使用 this.fs.copy 递归复制而不使用模板。

writing: function () {
    this.fs.copy(
      this.templatePath('views/static/views'),
      this.destinationPath('.views/static/views')
    );
  }

现在模板化时正确的语法应该是

writing: function () {
    this.fs.copyTpl(
      this.templatePath('index.html'),
      this.destinationPath('public/index.html'),
      { title: 'Templating with Yeoman' }
    );
  }