【问题标题】:Change library file while building app with grunt and wiredep使用 grunt 和wiredep 构建应用程序时更改库文件
【发布时间】:2016-03-22 14:54:02
【问题描述】:

我有来自 yeoman-angular 生成器的 Angular 应用程序。

我确实在 index.html 中有该代码:

<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
...
<script src="bower_components/moment/moment.js"></script>
...
<!-- endbower -->
<!-- endbuild -->

然后在 Gruntfile 中:

wiredep: {
        app: {
            src: ['<%= yeoman.app %>/index.html'],
            ignorePath:  /\.\.\//
        }
}

问题是我的项目中不仅需要moment/moment.js,还需要min/moment-with-locales.js。当然,在 index.html 中手动更改也无济于事。

也许有一些方法可以覆盖应该用于构建的库文件?

【问题讨论】:

    标签: javascript gruntjs bower momentjs wiredep


    【解决方案1】:

    解决方案似乎不在 Grunt 任务中,而是在 bower.json 中。 我不得不补充:

    "overrides": {
      "moment": {
        "main": "min/moment-with-locales.js"
      }
    },
    

    然后 grunt 将其添加到构建中,因此问题解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-23
      • 1970-01-01
      • 2016-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-23
      • 2021-07-30
      相关资源
      最近更新 更多