简体   繁体   中英

Change library file while building app with grunt and wiredep

I have angular application from yeoman-angular generator.

I do have that code in index.html:

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

and then in Gruntfile:

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

The problem is that i need not just moment/moment.js in my project, but min/moment-with-locales.js. Of course, it dosn't help to change it manually in index.html.

Maybe there is some way to override which library file should be used for building?

The solution appeared to be not in Grunt tasks, but in bower.json. I had to add:

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

And grunt added that to build, so problem was solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM