When creating websites or web apps there is a huge amount of back and forth between your code editor and the browser. There are an awful lot of actions you do that are repetitive. Gulp and Grunt help automate these actions to make the development process easier. It is certainly worth taking the time to set up either of these task runners because in the long run it will save you time and effort and improve your workflow! Both tools use Node.js.

I have only worked with Gulp so far and have found it very simple to set up, configure and start using in projects. Both task runners are similar but there are some pros and cons of each which can be seen below.

Both task runners come out of the box with tonnes of functions. Some of these functions can be easily performed yourself but if you have to do them manually a hundred times a day, a task runner makes sense!

Some of the functions you may want to automate can include:

  1. Minifying code
  2. Concatenating code
  3. Compressing images
  4. Converting SVG icons for browser support
  5. Browser sync
  6. Autoprefixer
  7. Precompiling LESS/SASS

Above are some of the more popular plugins, there are other cool ones that prevents the gulp build failing if you get an error, ones that enable on the fly language localisation, linting, running unit tests, batch renaming files and many more. More and more plugins come out every day as both are open source and have thriving comminities. There are almost 3,500 plugins currently in the Gulp plugin registry and almost 6,500 in the Grunt plugin registry at the time of writing this.

So get a sense of how many lines it takes to configure some of these functions using Gulp compared to Grunt, check out the sample below. This is the configuration necessary for optimising images on the fly. 

One of the cool things about Grunt and Gulp is that you can stray from the recommended configuration settings and customize your workflow entirely to suit your own needs.

The differences

Grunt is configured in a JSON style whereas Gulp is configured in just Javascript which is generally easier to write. Generally speaking Gulp code is easier to write than Grunt. If working on a large project requiring many plugins you will want to keep the configuration as simple as possible so adding new plugins is easy. This is a point to Gulp.

In terms of speed Gulp is the winner by a mile. Grunt have done a lot to bridge this speed gap but are still not there yet. This difference comes down to the fact that Gulp handles tasks in memory. A Gulp/Grunt speed test can be found here.

Both communities are very strong however you can see below that at the time of writing Gulp has over twice the number of Github start and over 3 times as many contributors!

  1. Gulp: 29,325 stars
  2. Grunt: 11,787 stars

Setting up Gulp and Sass and Sublime package control

  1. Set up Gulp globally – npm install -g gulp
  2. In your project folder install the plugins you require e.g. npm install gulp gulp-sass browser-sync -save-dev
  3. Next create a Gulpfile.js, where your configurations go
  4. For more info  check out this post

gulp.task defines your tasks, these are the functions that you want to automate. gulp.src points to the files we want to use. gulp.dest points to the output folder we want to write files to e.g. minified code / compressed images

What about Webpack?

Webpack is a module builder that can be used as a replacement to Gulp and Grunt. Essentially, Webpack bundles many modules into a few static assets representing those modules. Webpack offers many features right out of the box, some of which are not covered by Gulp/Grunt. There will be a future post about Webpack.


So which is better!?

There is no right or wrong answer. It depends on your project needs and if your preference to configure (Grunt) or to code (Gulp). Both are free and well documented so my advice is to set them up yourself, spend some time with each and base your decision off your experiences.


  1. Gulp
  2. Grunt
  3. Minifying images with Gulp and Grunt
  4. Popular plugins

Gulp vs Grunt

by Michael Gannon time to read: 3 min