Using Grunt with projects with different subfolders

Sometimes you will need to set up Grunt for automating tasks in more than a sub folder. Imagine a situation in which you have n sub folders, each with its own CSS and JS and you don’t want to trigger ALL your tasks for simply changing a file in ONE folder. Grunt allows you to handle these tricky situations, too.

As you can see, you can find all subfolders in your main folder directly inside your Gruntfile, using the grunt.file methods (docs here), create an array of subproject names and then using forEach to create your task dynamically.

Leave a Reply