Phong Duong


Set up Gulpjs for your project

17-09-2020 | #gulpjs

Gulpjs and its ecosystem provide a variety of tools and libraries for you to bundle and transform files. You can use it to automate tasks and speed up your workflow

Let's start setting up Gulpjs for your project by checking your environment. Gulpjs requires the following Nodejs and npm version

Nodejs: 8.11.1

npm: 5.6.0

Now you install the gulp-cli globally

npm install --global gulp-cli

Initialize your project

npm init -y

Install gulp as a devDependencies

npm install --save-dev gulp

Run the following command to check if your installation succeeds

gulp --version

It will print CLI version and your local Gulp version.

CLI version: 2.3.0
Local version: 4.0.2

Create a gulpfile.js in the root of your project with a task function and export it as default. Your function receives a callback function as the argument. You need to call this callback function if your task doesn't return anything

function task(cb) {

exports.default = task;

Run gulp command


You will see the output about the information of your task

[14:11:15] Using gulpfile F:\app\gulptest\gulpfile.js
[14:11:15] Starting 'default'...
[14:11:15] Finished 'default' after 1.89 ms

Congratulation, you have just set up Gulpjs and create a simple task for your project

Share: TwitterFacebookLinkedInHacker News