javascriptgruntjsbowermomentjswiredep

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?


Solution

  • 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.