Advantages of Using A Task Runner

·

3 min read

When Developing and Deploying an application in the front-end, there are a lot of tasks associated with it so that’s why we would use a Task Runner. This will speed up the process by making everything automated.

The type of tasks that we would want to be automated is things such as watching any change that happens in a file and we could even set it up to automatically reload a web page when you save a file to see any changes to an HTML, CSS or even a JavaScript file.

You can also minify CSS and JS files, auto prefix files for different browsers to make sure that the CSS will show how it is meant to be even for older browsers, minify image files and so much more. Using a Javascript task runner like Grunt or Gulp allows you to code and run your build tasks in the same language.

I use a task runner for every one of my projects I build as it just makes life easier in the long run and saves a lot of time having to minify files than pasting code on the websites to do it or reducing file sizes in Photoshop, etc.


grunt.png

What is Grunt?

Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file.

It is a task runner that is written on top of NodeJS. As I said before it basically will speed up the process by making everything automated by minifying files prefixing files, minifying images compiling SASS/LESS files to CSS files and also having a live local server and of course, there are still a lot more you can do with it.


gulp.png

What is Gulp?

Gulp is an open-source JavaScript toolkit by Fractal Innovations and the open-source community at GitHub, used as a streaming build system in front-end web development.

There is not much to say here since Gulp does pretty much the same thing, they both automate tasks, they both use Node, and they both require you to create tasks and install packages.


What Task Runner should you use?

Well, it’s a personal preference really if you have used one and not the other, just stick to the one you know already as they do the same thing unless you want to use the other. Grunt’s user base is small while Gulp’s is big and still growing and also it’s faster. I use Gulp as it’s the most popular now and it was the first one I learned.

So what are the advantages of using a Task Runner?

  • They are handy in large teams

  • Lots of packages to choose from

  • Easy to install

Thanks for reading!

Have a question? Connect with me via Twitter or send me a message at hello@dylansleith.com