Utilizing the Gruntfile.js file
The Gruntfile.js
file is the main configuration file for Grunt that handles all the tasks and task configurations. All the tasks and plugins are loaded using this file. In this recipe, you will create this file and will learn how to load Grunt plugins using it.
Getting ready
First, you need to install Node and Grunt, as described in the Installing Grunt recipe of this chapter. You will also have to install some Grunt plugins, as described in the Installing Grunt plugins recipe of this chapter.
How to do it...
Once you have installed Node and Grunt, follow these steps:
- In your Grunt project directory (the folder that contains the
package.json
file), create a new file, save it asGruntfile.js
, and add the following lines to it:module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //Add the Tasks configurations here. }); // Define Tasks here };
- This is the simplest form of the
Gruntfile.js
file that...