Yeoman生成器模板变量作为文件名

时间:2015-06-04 16:12:28

标签: variables generator yeoman

是否可以在从变量复制时设置文件名?

例如: Appname通过控制台设置。 网站标题是appname ..

var siteTitle = {
  site_name: this.appName
};


this.template("html/_index.html", "app/html/index.html", siteTitle);

这将设置占位符appname。一切都很好。

但是我想做类似的事情:将css文件命名为appName,并将父类设置为appname(这样可行)。

this.template("css/_main.css", "app/css/" + siteTitle + ".css", siteTitle);

这可能吗?像这样,我已经完成它不起作用。

电贺, 谢尔盖

1 个答案:

答案 0 :(得分:1)

好的,刚解决了这个问题。

而不是使用变量

this.template("css/_main.css", "app/css/" + siteTitle + ".css", siteTitle);

我需要直接使用appName

this.template("css/_main.css", "app/css/" + this.appName + ".css", siteTitle);
相关问题