How to use Grunt in existing project

01 / Aug / 2015 by Satyam Chaudhary 0 comments

I am very glad to explain about the Grunt, because i feel it makes my life easy.

Always keep in mind, use your valuable time in creative activities, not in repetitive and boring tasks in web development.

In this context, grunt is very helpful for everyone.

So, a basic question is “What is Grunt?”

It is a task runner. Through which you can automate your most repetitive tasks.

For using grunt, first of all you have to install grunt-cli ( It would be more helpful if you installed grunt-cli globally in your system ). npm install -g grunt-cli
Note: If you don’t want to install grunt globally remove -g from given command.

A basic example of Grunt:

Follow these steps to configure Grunt in existing project
1. Install grunt ( run following command from project root directory)

npm install -S grunt

2. create Gruntfile.js in root directory
3. Write following code inside the Gruntfile.js
module.exports = function (grunt){

grunt.registerTask(‘singing’, function () {
console.log(‘I am Singing’);

console.log(‘I am dancing’);

console.log(‘I am acting’);


4. Run following command and examine the output
grunt singing
grunt dancing
grunt both

For Reference:


Leave a Reply

Your email address will not be published. Required fields are marked *