【问题标题】:How do I change the path for generated files for the generator-angular in yeoman如何更改 yeoman 中生成器角度的生成文件的路径
【发布时间】:2013-09-24 00:48:26
【问题描述】:

我的问题:

来自https://github.com/yeoman/generator-angular的自述文件

yo angular:controller user

生产

app/scripts/controllers/user.js

如何让它产生

app/js/controllers/user.js

我看过的内容:

我不认为我可以配置路径,因为源显示路径是硬编码的:

Generator.prototype.createControllerFiles = function createControllerFiles() {
  this.appTemplate('controller', 'scripts/controllers/' + this.name);
  this.testTemplate('spec/controller', 'controllers/' + this.name);
  this.addScriptToIndex('controllers/' + this.name);
};

https://github.com/yeoman/generator-angular/blob/master/controller/index.js#L22

我考虑过分叉项目并更改代码,但这感觉很脏。 我希望有一个我可以更改的配置,但是没有 github wiki,所以我不能完全 RTM 找到配置选项。我尝试查看https://github.com/yeoman/generator-angular/blob/master/script-base.js,但这也不是很有帮助。

【问题讨论】:

    标签: angularjs yeoman


    【解决方案1】:

    不幸的是,目前还没有解决此问题的方法。

    但好消息是,团队正在为此制定解决方案。见this Twitter conversation。

    【讨论】:

    • 很高兴看到。我正在尝试将它与 linemanjs 结合使用,结果在我的项目中破坏了一堆东西 T.T
    • 是的,我可以想象,这些路径的配置对于真正将 Angular 应用程序添加到任何站点非常重要。
    • 我自己也在研究这个。我在 generator-angular github.com/yeoman/generator-angular/commit/… "allow move of app and test folder via component.json" 上找到了这个页面,所以看起来这种行为在某些时候被弃用了?
    猜你喜欢
    • 2014-01-14
    • 2015-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多