Search code examples
javascripthtmlnode.jsyeoman

yeoman/grunt-usemin not updating index.html after new js has been added


I am using yeoman with the angular generator for a web app on windows7. After running yo angular I run grunt to build the app for deployment. My index.html file in the dist folder is changed accordingly with the css and js files that was concatenated and minified.

When I add a new js file to index.html for example

<script src="bower_components/json3/lib/json3.js"></script>

and I run grunt again to build; the index.html file no longer changes the css aan js files to the minified ones, it basically shows exactly the same as the index.html in the app directory.

I also tried putting the json3.js inside the build:js comments:

 <!-- build:js scripts/json.js -->
 <script src="bower_components/json3/lib/json3.js"></script>
 <!-- endbuild -->

Is there something I am missing here? Must I change something in the grunt file like the usemin section?


Solution

  • I repeatedly bumped into this problem and have found a solution in my case.

    I am using vs 2012 to create my HTML and cmd for the grunt tasks. It seems that my Line endings were not correct, so I changed them to Unix (LF) and grunt-usemin did its thing. When settings the line endings to Windows (CR LF) grunt-usemin don’t update the index.html page correctly.

    Hope this helps somebody!