Our environment is set up; let's do something with it. We need something that will automatically run tasks. This is where Grunt comes in. We can give it a list of tasks that Grunt will execute. The first thing we need to do is create a Gruntfile.js
file.
Gruntfile.js
configures Grunt. It tells Grunt what tasks to carry out, how to run each task, and in what order. We can now create a basic Gruntfile.js
file in the root of the project. Add the following code snippet to the file:
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json') }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-preprocess'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-nodeunit'); // Default task(s). grunt.registerTask('default', []); grunt.registerTask('prep', []);...