Don't know how to use Grunt? Find out here!

Step-by-step guide

Install grunt

$ sudo npm install -g grunt-cli

Initialise package.json

$ npm init

Install grunt task runner

$ npm install grunt --save-dev

Create a Gruntfile.js containing this

 

module.exports = function(grunt) {
    grunt.initConfig({


    });
}

 

Install load-grunt-tasks

$ npm install load-grunt-tasks --save-dev

Add the config to Gruntfile.js

 

module.exports = function(grunt) {
    require('load-grunt-tasks')(grunt);
    grunt.initConfig({
    ...

 

You are now good to go, adding plugins for the tasks you might need! Here are two to start you off:

  1. grunt-contrib-sass
  2. grunt-contrib-uglify

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.