Debugging Grunt Jobs in WebStorm
Actually, I have PhpStorm, but I think everything will work in WebStorm as well.
Run on the command line
Where img2base64 is the name of the desired job. You can omit this parameter to start all jobs.
We get debugger listening on port 64005
Next in WebStorm : Run → Edit configurations ... → + → Node JS Remote Debug. Set the configuration name (for example, grunt), Host: 127.0.0.1, Debug port: 64005 ( you can specify any port from 1025 to 65535, the main thing is the same everywhere ). Click OK.
Set a breakpoint and click the Debug button .

Profit!
Here's what the window looks like when debugging

Debugging in WebStorm (in any JetBrains IDE) - http://www.jetbrains.com/webstorm/webhelp/running-and-debugging-node-js.html
Debugging in a browser (Google Chrome or another on WebKit) - https: //github.com/dannycoates/node-inspector
Run on the command line
cd
node --debug-brk=64005 $(which grunt) img2base64
Where img2base64 is the name of the desired job. You can omit this parameter to start all jobs.
We get debugger listening on port 64005
Next in WebStorm : Run → Edit configurations ... → + → Node JS Remote Debug. Set the configuration name (for example, grunt), Host: 127.0.0.1, Debug port: 64005 ( you can specify any port from 1025 to 65535, the main thing is the same everywhere ). Click OK.
Set a breakpoint and click the Debug button .

Profit!
Here's what the window looks like when debugging

useful links
Debugging in WebStorm (in any JetBrains IDE) - http://www.jetbrains.com/webstorm/webhelp/running-and-debugging-node-js.html
Debugging in a browser (Google Chrome or another on WebKit) - https: //github.com/dannycoates/node-inspector