Getting started with gulp.js

Last Updated: February 3, 2018

What is Gulp?

You can do bunch of diffrent things with Gulp. If you develop your project with Saas or Less and you need to convert it to CSS you can use Gulp to do it. If you want to minify your CSS and js file to make your website faster you can use Gulp to do it

Glup uses the concept to pipes which take one file and process the file with a plug-in, then process file is passed to another plug-in for processing

First you install the gulp globally

sudo npm install -g gulp

In terminal, you can change directory to the root directory of your project and run the following command to initiate project
npm init
Then you can install Gup as development dependency in your project

npm install --save-dev gulp
npm install --save-dev gulp-util

Now you create a gulpfile.js where you write you Gulp tasks. You can add the following code to that file

var gulp = require("gulp");
var gulputil= require('gulp-util');

	gulputil.log("Hello World");

Now you can run the Gulp task log

gulp log

So this will give you the following output in your terminal

[21:00:39] Using gulpfile ~/Documents/dev/gulp/gulpfile.js
[21:00:39] Starting 'log'...
[21:00:39] Hello World
[21:00:39] Finished 'log' after 9 ms