A while ago I started to use Grunt in my projects and once you get your head around it, it can be a great helper. Unfortunately I find the documentation for some things hard to find and sometimes difficult to understand right away, so this shall serve as a note, in case you run into the same problem.
I’m using grunt-processhtml to replace various CSS and JS files with different ones, after the sources have been processed otherwise. So far my approach has always more or less looked like this, moving the processed file into the ‘dist’ directory:
For my latest project there are many more HTML files than just only one that need processing and the list suddenly got quite long. This wasn’t a maintainable solution after all:
As a result I wanted to grab all HTML files in the root directory, process them and then save the resulting file in a directory called ‘dist’. I couldn’t quite work out how to get this done and the documentation on file handling at first didn’t help either, but after looking at different other Grunt tasks and their file operations I finally figured it out. The solution to what I wanted to do now looks like this and works just like I needed it to:
There are probably other options you can use but for now I’ll leave this for the basic task that gets the job done. I hope this helps in case you are looking for the same or similar solution.