Registry / devops / gulp
library0.1.0jsnpmunverified

Gulp is a powerful, streaming build system designed to automate repetitive and time-consuming tasks in development workflows. It operates by piping files through a series of small, single-purpose plugins, treating files as streams. The current stable version is 5.0.1, with releases typically occurring as needed for bug fixes, performance improvements, or new features rather than on a fixed schedule. Key differentiators include its code-over-configuration philosophy, minimal API surface, and functional approach, which encourages writing small, focused tasks that compose together. It's platform-agnostic, integrating with various IDEs and usable across PHP, .NET, Node.js, Java, and other environments, boasting a strong ecosystem with over 3000 curated plugins available via npm. The emphasis on streams and direct code manipulation provides a high degree of control and flexibility.

npm install gulp
INSTALL
IMPORT
SIG · GULP
G
gulp
devopsjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

{ src, dest, series, parallel, watch }
import { src, dest, series, parallel, watch } from 'gulp';
const { src, dest, series, parallel, watch } = require('gulp');
Preferred modern ESM import style for named exports when using `type: 'module'` in package.json or `.mjs` files.
gulp
import gulp from 'gulp';
const gulp = require('gulp');
ESM default import for the entire gulp API, less common as specific functions are usually destructured.
gulp
const gulp = require('gulp');
import gulp from 'gulp';
CommonJS `require` syntax, still widely used in older projects or when `type: 'module'` is not specified in package.json. Will throw errors if used in an ESM context.

This quickstart `gulpfile.mjs` demonstrates an asynchronous cleanup task, followed by parallel compilation, minification, and concatenation of Less styles and ESNext JavaScript, with a watch task for continuous development. It showcases modern ESM syntax for Gulp 5.

import { src, dest, watch, series, parallel } from 'gulp'; import less from 'gulp-less'; import babel from 'gulp-babel'; import concat from 'gulp-concat'; import uglify from 'gulp-uglify'; import rename from 'gulp-rename'; import cleanCSS from 'gulp-clean-css'; import del from 'del'; const paths = { styles: { src: 'src/styles/**/*.less', dest: 'assets/styles/' }, scripts: { src: 'src/scripts/**/*.js', dest: 'assets/scripts/' } }; async function clean() { return del(['assets']); } function styles() { return src(paths.styles.src) .pipe(less()) .pipe(cleanCSS()) .pipe(rename({ basename: 'main', suffix: '.min' })) .pipe(dest(paths.styles.dest)); } function scripts() { return src(paths.scripts.src, { sourcemaps: true }) .pipe(babel({ presets: ['@babel/preset-env'] })) // Ensure @babel/preset-env is installed .pipe(uglify()) .pipe(concat('main.min.js')) .pipe(dest(paths.scripts.dest)); } function watchFiles() { watch(paths.scripts.src, scripts); watch(paths.styles.src, styles); } export const cleanTask = clean; export const stylesTask = styles; export const scriptsTask = scripts; export const watchTask = watchFiles; export default series(clean, parallel(styles, scripts));
gulp --version
Debug
Known issues
breakingGulp v5 dropped support for Node.js versions older than 10.13. Projects on unsupported Node.js versions will fail to run Gulp 5 tasks.
fix
Upgrade your Node.js environment to version 10.13.0 or higher. For best compatibility, use a current LTS release.
affects: >=5.0.0
breakingIn Gulp v5, the default stream encoding was standardized to UTF-8. This may affect tasks that process files with different encodings if not explicitly handled.
fix
Review tasks that read or write files to ensure they correctly handle file encodings. Explicitly specify encoding options where necessary, especially for non-UTF-8 files.
affects: >=5.0.0
breakingGulp v5 standardized on the `anymatch` library for globbing paths, ensuring consistent behavior between `src` and `watch`. Additionally, support for ordered globs was removed.
fix
Verify existing glob patterns, especially complex ones or those relying on specific ordering. Adjust patterns if `anymatch` behavior differs from previous implementations or if ordered glob assumptions were made.
affects: >=5.0.0
breakingGulp v4 removed the `gulp-util` package, a utility library commonly used in older gulpfiles and plugins. This means direct usage of `gulp-util` will result in errors.
fix
Replace `gulp-util` functionalities with standard Node.js modules or dedicated, modern npm packages. Many plugins that depended on `gulp-util` have been updated or have modern alternatives.
affects: >=4.0.0
gotchaUsing `require()` in a Gulpfile named `.mjs` or when `type: "module"` is set in `package.json` will result in `ReferenceError: require is not defined`.
fix
For ES Modules context, use `import` statements. If you need CommonJS `require`, ensure your gulpfile is `.js` and your `package.json` does not specify `"type": "module"`.
affects: >=4.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use CommonJS `require()` syntax within an ES Module (ESM) file context, such as a `gulpfile.mjs` or a `.js` file where `"type": "module"` is set in `package.json`.
fix
Change all `require()` calls to `import` statements. For example, `const gulp = require('gulp');` becomes `import gulp from 'gulp';` or `import { src, dest } from 'gulp';`.
The following tasks did not complete: default. Did you forget to export them?
A task function defined in the gulpfile was not exported correctly, preventing Gulp from discovering or executing it.
fix
Ensure that your task functions are explicitly exported. For example, `function myTask() {...}` should be `exports.myTask = myTask;` in CommonJS or `export const myTask = myTask;` in ESM, or included in an exported `series` or `parallel` composition.
Error: Cannot find module 'gulp-plugin-name'
A Gulp plugin is being `require()`d or `import`ed in the gulpfile but has not been installed via npm, or there's a typo in the package name.
fix
Install the missing plugin using `npm install --save-dev gulp-plugin-name` or `yarn add --dev gulp-plugin-name`. Double-check the spelling of the module name.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
delrequiredCommonly used for cleaning directories in gulpfiles, as demonstrated in official examples.
gulp-clioptionalProvides the command-line interface to run gulp tasks; typically installed globally or as a dev dependency.
Agent activity
17 hits · last 30 days
node
16
Resources