LinuxCommandLibrary

gulp

Automate front-end development workflows

TLDR

Run the default task

$ gulp
copy

Run individual tasks
$ gulp [task] [othertask]
copy

Print the task dependency tree for the loaded gulpfile
$ gulp --tasks
copy

SYNOPSIS

gulp [options] [task ...]

PARAMETERS

-f, --gulpfile
    Path to gulpfile (default: gulpfile.js)

-P, --cwd


    Working directory (default: .)

--color
    Force color output

--no-color
    Disable color output

-s, --silent
    Silence all output

-C, --continue
    Continue despite errors

-T, --tasks
    List all tasks with descriptions

-t, --tasks-simple
    Simple list of tasks

-v, --version
    Display version information

-h, --help
    Display help

DESCRIPTION

Gulp is a popular open-source task runner for Node.js projects, designed to automate repetitive development tasks like minification, concatenation, linting, testing, and file watching. Unlike configuration-heavy tools, Gulp emphasizes code over configuration, allowing tasks to be defined directly in JavaScript using Node's streams for efficient, memory-friendly file processing.

At its core, Gulp reads a gulpfile.js (or similar) that exports tasks as functions. Plugins, installed via npm, handle specific operations (e.g., gulp-uglify for compression). Developers chain tasks via streams: source files → transform → destination.

Installation requires Node.js/npm: globally install the CLI with npm install --global gulp-cli, then per-project npm install --save-dev gulp. Run tasks via gulp (default task), gulp build, or list with gulp --tasks. Gulp supports series/parallel execution and orchestration.

While webpack and others have overshadowed it for bundling, Gulp excels in simple, fast pipelines. Its plugin ecosystem exceeds 4,000 packages, ensuring flexibility. Version 4.x introduced better async support and task dependencies. (178 words)

CAVEATS

Requires Node.js/npm and gulp-cli installed globally. Not a native Linux utility; tasks defined in project-specific gulpfile.js. Performance depends on plugins.

INSTALLATION

npm i -g gulp-cli
npm i --save-dev gulp

BASIC USAGE

Create gulpfile.js:
const gulp = require('gulp');
gulp.task('default', () => { /* task code */ });

Run: gulp

HISTORY

Released in April 2013 by Eric Schoffstall (Fractal Innovations), Gulp revolutionized JS builds with streams vs. Grunt's temp files. Version 4.0 (2019) added async/await support. Now at 4.0.2 (2020), maintained by open-source community amid webpack's rise.

SEE ALSO

node(1), npm(1), grunt(1)

Copied to clipboard