Gulp is a popular, open-source streaming build system for automating time-consuming development tasks, primarily in web development. It leverages Node.js streams to process files in memory, which often results in faster build times compared to tools that write intermediate files to disk. The current stable version is 5.0.1. Gulp differentiates itself from alternatives like Grunt by favoring a 'code-over-configuration' approach, allowing developers to define tasks using standard JavaScript functions and Node.js APIs, offering greater flexibility and direct control over the build process. It boasts a strong ecosystem with thousands of plugins available via npm to handle various file transformations and manipulations. Its platform-agnostic nature makes it suitable for projects across different languages and environments.
npm install gulp-preVerified import paths — ran on the pinned version, not inferred.
This `gulpfile.js` demonstrates defining Gulp 4 tasks using plain functions, composing them with `gulp.series` and `gulp.parallel`, and using `gulp.src` and `gulp.dest` with popular plugins for cleaning, image optimization, CoffeeScript compilation, minification, concatenation, and sourcemap generation. It also includes a `watch` task for development.
Rewrite task dependencies using `gulp.series()` and `gulp.parallel()` combinators. For example, `gulp.task('build', gulp.series('clean', gulp.parallel('scripts', 'styles')))`.Ensure your task function returns a stream (e.g., `gulp.src(...).pipe(...)`), returns a Promise (e.g., `return del(['build'])`), or accepts a `done` callback and calls `done()` when finished.
Use named functions for tasks, either by defining them separately and passing the reference (`function myTask() {}; gulp.task(myTask);`) or by exporting them directly (`exports.myTask = function() {};`).For CommonJS `gulpfile.js`, use `del` version `^6.0.0`. If you need `del@7.0.0` or newer, migrate your `gulpfile.js` to ES Modules (e.g., rename to `gulpfile.mjs` or set `"type": "module"` in `package.json`).
Ensure `gulp-cli` is installed globally and `gulp` is installed as a dev dependency in your project. Verify versions with `gulp -v`.
Replace the dependency array with `gulp.series()` or `gulp.parallel()`. Example: `gulp.task('name', gulp.series('dep', function() {}))`.Ensure the referenced task is either defined as a named function and passed to `gulp.task(myTask)` or `exports.myTask = myTask`, or directly passed as a function to `gulp.series()`/`gulp.parallel()`.
Double-check task names for typos. Ensure tasks intended to be run by string name are correctly exposed either by `gulp.task('taskName', myFunc)` or by `exports.taskName = myFunc` if using the modern module pattern.Remove `.sync()` and ensure your task returns the Promise from `del()`. Example: `function clean() { return del(['build']); }`. If still failing, check `del` version compatibility with your `gulpfile`'s module system (CJS vs ESM).