I have two Angularjs projects scaffolded using Yeoman. The first project is a library that has been scaffolded with the Angular Library Generator while the second is a full app scaffolded with the Yeoman Angular Generator. I want the App to use the Library so in the App directory I installed the library using Bower:
bower install github-id/library-name --save
Although the library is not registered with Bower I can still install it with my Github Id and library name. The bower_components
directory now holds the library and its dependencies but when I run Grunt using grunt serve
or just grunt
, the App's Index.html
file is not being updated with the library, although you can see that other modules such as lodash
, for example, are there:
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<script src="bower_components/lodash/lodash.js"></script>
<!-- endbower -->
<!-- endbuild -->
And if I try to add the library as a script tag manually, Grunt
subsequently removes any tags that I add.
Can anyone tell me why the tags are not being added?
Thanks!
The problem was solved by looking in the bower.json file of library project in the
bower_components
directory of my app. In the bower.json file, the path given under the "main" field was incorrect. Once this was fixed then the library was added to the `index.html correctly.