Instead of loading all the required Grunt plugins one by one, you can load them automatically with the load-grunt-tasks
plugin.
For this recipe, you need to install the load-grunt-tasks
plugin. You can install this by using the following command in the root of your project:
$ npm install load-grunt-tasks --save-dev
Add the following line at the very beginning of your Gruntfile.js
file after module.exports
:
require('load-grunt-tasks')(grunt);
Now your Gruntfile.js
file should look like this:
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
app: {
dev: 'app/dev'
},
//Add the Tasks configurations here.
});
// Define Tasks here
};