encyclopegia.org

Gulp.js

gulp is an open-source JavaScript toolkit, used as a streaming build system (similar to a more package-focused Make) in front-end web development.[src] It is a task runner built on Node.js and npm, used for automation of time-consuming and repetitive tasks involved in web development like minification, concatenation, cache busting, unit testing, linting, optimization, etc.[src] gulp uses a code-over-configuration approach to define its tasks and relies on its small, single-purpose plugins to carry them out.[src] The gulp ecosystem includes more than 3500 such plugins.[src]

gulp is an open-source JavaScript toolkit, used as a streaming build system (similar to a more package-focused Make) in front-end web development.[src] It is a task runner built on Node.js and npm, used for automation of time-consuming and repetitive tasks involved in web development like minification, concatenation, cache busting, unit testing, linting, optimization, etc.[src] gulp uses a code-over-configuration approach to define its tasks and relies on its small, single-purpose plugins to carry them out.[src] The gulp ecosystem includes more than 3500 such plugins.[src] Any installed plugin that is required to perform a task is to be added at the top of the gulpfile as a dependency in the following format.[src] //Adding dependencies var gulp = require ('gulp'); The following example shows the creation of a gulp tasks.[src] The first parameter taskName is mandatory and specifies the name by which the task in the shell can be executed.[src] gulp.task('taskName', function () { //do something }); Alternatively, a task that performs several predefined functions can be created.[src] Those functions are passed as the second parameter in the form of an array.[src] function fn1 () { // do something } function fn2 () { // do something } // Task with array of function names gulp.task('taskName', gulp.parallel(fn1, fn2)); The default task is to be defined at the end of the gulpfile.[src] It can be run by the gulp command in the shell.[src] In the case below, the default task does nothing.[src] // Gulp default task gulp.task('default', fn); The default task is used in gulp to run any number of dependent sub tasks defined above in a sequential order automatically.[src] gulp can also monitor source files and run an appropriate task when changes are made to the files.[src] The sub tasks are to be mentioned as the elements of the array in the second parameter.[src] The process can be triggered by simply running the default task by gulp command.[src] The module definition can be at the beginning of Gulpfile.js like so: var imagemin = require('gulp-imagemin'); The subsequent image task optimizes images.[src] gulp.src() retrieves all the images with the extension .png, .gif or .jpg in the directory images-orig/'.[src] .pipe(imagemin()) channels the images found, through the optimization process and with .pipe(gulp.dest()) the optimized images are saved to the images/' folder.[src] Without gulp.dest() the images would indeed be optimized, but are not stored.[src] Since the optimized images are stored to another folder, the original images remain unaltered.[src] // Images task gulp.task('images', function () { return gulp.src('images/*.{png,gif,jpg}') .pipe(imagemin()) .pipe(gulp.dest('dist/images/')); }); In the following example, all JavaScript files from the directory scripts/ are optimized with .pipe(uglify()) and gulp.dest('scripts/') overwrites the original files with the output.[src] For this, one must first return to the required gulp-uglify plugin on npm package installer and at the beginning of gulpfile, the module should be defined.[src] // Script task gulp.task('scripts', function () { return gulp.src('scripts/*.js') .pipe(uglify()) .pipe(gulp.dest('scripts/')); }); The Watch-task serves to react to changes in files.[src] In the following example, the tasks with the names scripts and images are called when any of JavaScript files or images change in the specified directories.[src] // Rerun the task When a file changes gulp.task('watch', function (cb) { gulp.watch('scripts/js/**', scripts); gulp.watch('images/**', images); cb(); }); Furthermore, it is possible to accomplish an update of the browser content using the Watch-tasks.[src] For this, there are numerous options and plugins.[src] ==See also== Grunt (software) Browserify ==References== ==Literature==[src]

32 sentences · 32 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Gulp.js." encyclopegia.org, 2026, https://encyclopegia.org/wiki/gulp-js. Accessed 25 November 2026.

Chicago

"Gulp.js." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/gulp-js.

APA

encyclopegia.org. (2026). Gulp.js. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/gulp-js

Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1376308412 · 0.5 · snapshot enwiki-001376308412

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.