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.
First, you need to install Node and Grunt as described in the Installing Node and 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.
Once you have installed Node and Grunt, follow these steps:
In your Grunt project directory (the folder that contains the
package.json
file), make a file, save it asGruntfile.js
, and add the following lines to it:module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), app: { dev: 'app/dev' }, //Add the Tasks configurations here. }); ...