automationgruntjsbowergrunt-wiredep

How to replace wiredep injected code in production build?


I am using bower for package management. Also for automatically putting bower components to HTML I am using grunt-wiredep. I got both of them integrated into my project and working well.

For the production server, I want to minify and concat the bower components and put the path of this new file to the my HTML. I use bower_concat for concatenating the minified files.

But how will I replace wiredep script tags with this concatenated script tag? Is there any automated way of doing it?


Solution

  • Finally I got an answer, putting here for others.

    We can use the grunt-processhtml plugin.

    <!-- build:js js/third-party.min.js -->
    <!-- bower:js --> 
    <!-- endbower -->
    <!-- /build -->

    if we put this in the html files, wiredep will fill the bower dependencies and processhtml will replace it with js/third-party.min.js