我正在使用 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' }
);
}
关于node.js - 无需模板的 Yeoman 复制目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33940207/