September 2014
Intermediate to advanced
316 pages
7h 6m
English
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'); ...