Grunt.js has dependency on Node.js. Before we install the Grunt, we need to install the Node.js.
Installing the Grunt.js involves the following steps.
- Install latest version of Node.js from below link
Website : https://nodejs.org/en/
2. Install grunt-cli globallly. using -g. That means we don’t need to install every time whenever we want it across our computer.
npm install grunt-cli -g
3. Create a package.json file using npm-init as show below:
What is package.json ?
All npm packages contain a file, usually in the project root, called package.json – this file holds various metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project’s dependencies.
4. Install grunt locally
npm install grunt --save-dev
This will add grunt to the package.json as follows:
5. Creating the Gruntfile.js by right click and create a new file in the Project folder
6. Install plug-ins
We will install all the plug-ins and configure grunt-js in gruntFile.js. We will explain this in next article.