How to automatically, with Grunt, link to new (mined and concatenated) JavaScript files in HTML?

My index.html page looks like this:

<html> <script src="js/file1.js"></script> <script src="js/file2.js"></script> <script src="js/file2.js"></script> </html> 

Using grunt , I was able to concatenate and minimize js files to a single file in prod/js/file.min.js I also have a new index.html page in prod/index.html , which is minify.

Now the problem is that this new index.html page is still referencing the old three javascript files, not the new separate javascript file. How can I change this in a grunt?

final html file should be:

  <html> <script src="js/file.min.js"></script> </html> 
+5
source share
1 answer

You can use the grunt-processhtml plugin to replace it

https://www.npmjs.com/package/grunt-processhtml

+2
source

All Articles