Search code examples
angularjsgruntjsyeomanboweryeoman-generator-angular

Grunt serve (from angular generator) removes angular-route from index.html


I have used yeoman angular-generator to generate project and gruntfile.js.

I have bower.json:

{
  "name": "boot-ang",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.2.15",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0"
  },
  "devDependencies": {
    "angular-mocks": "1.2.15",
    "angular-scenario": "1.2.15",
    "bootstrap": "~3.1.1",
    "angular-route": "~1.2.16"
  }
}

This is part of my index.html

<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<!-- endbower -->
<!-- endbuild -->

When I run grunt serve, angular-route is being removed from bower:js. Why's that?


Solution

  • Currently in your bower.js, angular-route is in the devDependencies, you may want to switch it to dependencies like where angular or json3 are loaded.

    devDependencies are for things like unit-tests or documentations and the grunt serve is removing it because he don't think it's usefull to add it in the index.html.

    You may want to install script with the command

    bower install angular-route --save
    

    instead of

    bower install angular-route --save-dev