Personal site of Pieter Bogaerts

Build a Grunt project using Webstorm

Whenever you're using Grunt to build static files for your project you don't want to build the whole project everytime, building the files you just worked on is sufficient and way faster.

Building the files you just worked on can be achieved by using a path in your Grunt configuration. Depending on your Grunt configuration you have to pass the location of the folder containing the file(s) you just worked on to the Grunt task. This can easily be achieved by using Webstorm's External Tools.

Go to the settings of Webstorm and click on Tools -> External Tools -> +

Fill in the name and description of your task. At the Tool Settings part fill in 'grunt' (without quotes) as the program.

Now as parameter use '--path=$FileParentDir$' (without quotes).

As working directory fill in '$ProjectFileDir$' (without quotes).

Now you can assign a keyboard shortcut in Webstorm to easilly run the task.