我有来自 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中手动更改它并没有帮助。
也许有某种方法可以覆盖应该使用哪个库文件来构建?
最佳答案
解决方案似乎不在 Grunt 任务中,而是在 Bower.json 中。 我必须添加:
"overrides": {
"moment": {
"main": "min/moment-with-locales.js"
}
},
然后 grunt 将其添加到构建中,所以问题就解决了。
关于javascript - 使用 grunt 和wiredep 构建应用程序时更改库文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36157739/