Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting.

Installing Grunt

To install grunt first you must have NodeJs installed, NodeJS will have npm (node packaged modules) Run the following commands

  • Install grunt-cli globally by running the following command npm install -g grunt-cli

  • Gruntfile.js file is a valid JavaScript or CoffeeScript file that belongs in the root directory of your project, next to the package.json file, and should be committed with your project source.

  • Navigate to the root directory of your project, then run npm install.

Once you have successfully setup now you can use Grunt CLI commands to automate your task


grunt dist

This will automatically copy all the assets from node_modules to vendors folder

grunt sass

This will compile all the sass files to dist/css/style.css

grunt watch

This will automatically compile the sass files on changes


This will run 4 grunt tasks:

  1. Sass file compilation

  2. Jshint check

  3. It will connect web server on http://localhost:9000

  4. Watch for the changes in sass files

Your are free to customize the Grunt task to your need by editing the Gruntfile.js in the root directory.