Messing about with gulpjs

So I've just literally finished messing about with gulp – opened a new tab in sublime and started typing this article. I've been using Grunt for a while to run tasks mainly for my jekyll sites, but when I head about gulp on an episode of the Shop Talk Show I decided to check it out.

Gulp vs Grunt

The first thing I noticed was gulp is fast, super fast, possibly because it uses streams which Grunt doesn't (read more about it on the gulpjs site). Syntax between both is slightly also different, gulp is written like a standard node js app which will make node devs feel right at home whereas Grunt is completely different. Basically you can do more with less code in gulp. Grunt however has way more plugins than gulp, since it's been around for a lot longer.

I haven't actually looked into the details but apparently gulp doesn't produce as many tmp/log files as Grunt does, I'm not completely sure how that stuff works though.

Getting Started

Gulp runs on nodejs so if you haven't done so already – go download and install node it's a simple executable file for Mac & Windows users. I'm not sure how it works on Linux machines.

Note: If you're on a Windows machine ignore the 'sudo' command and just open the command line as an Administrator.

1.Open up your command line/terminal and type

sudo npm install -g gulp

This should install gulp globally(-g) on your machine.

2.You now need to go into the directory of your project and type.

npm install --save-dev gulp

This will make gulp a dev dependancy in your package.json file.

Note: You can install gulp-util as well as gulp with this command.

npm install --save-dev gulp gulp-util

But I've never needed to use gulp-util so I usually avoid it.

3.Now make a new file called gulpfile.js in the root of your project folder and paste this into it.

4 Responses

Add your response

gulp-util is used to do a bunch of things with streams from combining them to buffering them. You need it if you want to make your own gulp plugin (I think) and it is required for certain plugins to work.