Grunt vs. Gulp - we have made our choice

There is an ongoing discussion over the Internet which tool is better for task automation - is it Grunt or is it Gulp. I am sharing my thoughts on this topic below and indicate which one is my favourite.

Writing code

Grunt configuration is based on a JSON structure when describing tasks and options. Sometimes it is problematic for me to find where in the structure should I put certain parameters and what kind of options are available. An example from one of our projects:

  copy: {
    main: {
      files: [
        {
          expand: true,
          cwd: ‚src/lib/‚,
          src: [‚**’],
          dest: ‚dist/lib/‚
        }
      ]
    }
  }

Gulp took a different approach as it is based on a „code-over-configuration” philosophy where you define tasks by writing javascript or coffeescript code. So a similar task to the one above would look like this in Gulp:

gulp.task(‚copy’, [‚clean’], function() {
  gulp.src(„src/lib/**/*”)
  .pipe(gulp.dest(„dist/lib”))
})

With such code I don’t need to worry if „files” list should be in section „main”, which option „expand” is responsible for etc.

Point for: Gulp

The power of streams

Gulp, contrary to Grunt, uses node streams (just have a look at this part of the above code .pipe(gulp.dest(„dist/lib”))). This way you can pass a result of one operation directly to another, for example: a complex coffeescript file can be sent to minification without a need to create temporary folders, as it happens in Grunt.

Point for: Gulp

Orchestration

Gulp uses orchestration to make use of parallel tasks execution and to minimise time needed for them to complete. A developer needs to only set relations of one task to the others and Gulp makes sure they run in correct order.

Point for: Gulp

Plugins

As Grunt has been available for many years it has a wide range of plugins that can be used. Gulp is a pretty new solution but it is quickly gaining traction and there is a growing community of developers using it on a daily basis.

Point for: Grunt

Verdict

Gulp vs Grunt: 3:1

In TEONITE we use Grunt for our older projects as with the new ones we automate tasks using Gulp. We keep fingers crossed for the future of this tool and believe that more developers will contribute to it.

hire us

Let’s talk about Mobile Apps

We’d love to design, develop and release them for you.

Highest DevOps Standards

Our team wield the right skills to make things work.

Angular magic in the making

Most flexible development technology for stunnig results.

Web Apps cooked the right way

The ultimate combination of code, design and user experience.

Django REST Framework

TEONITE develops, supports and donates open source projects.