Grunt Running From Root Directory
If you are a web developer and you are using Grunt as your default task runner, you probably in most of the cases use it from some inner folder of the project, something like ”client/app”.
In this case, every time you want to work on your code using command like ”grunt serve”, you need to change directory into client/app to run it all the time.
Below, I show you the way to make grunt commands work from root directory which makes your life more comfortable, eliminating the need switching to client/app directory all the time.
- Add in your original client/app/Gruntfile.js file the following code to let Grunt know the base directory location:
1 2 3 4 5 6 7
2.. Add symbolic link in your root directory to original client/app/Gruntfile.js file:
3.. Create package.json in root directory with grunt as dependency and install Grunt:
4.. Run grunt from root to test it.
That’s it, pretty simple. Hope you like it and use it.