Gulp

Alexa's Ranking: 78,810

Gulp is a toolkit to automate and enhance your workflow. It is:

Flexible: Using code over configuration, you can utilize all of JavaScript to create your gulpfile, where tasks can be written using your code or chained single-purpose plugins.

Composable: You can write individual, focused tasks and compose them into larger operations, providing you with speed and accuracy while reducing repetition.

Efficient:By using gulp streams, you can apply many transformations to your files while in memory before anything is written to the disk—significantly speeding up your build process.

To install the Gulp:

npm install –g gulp-clinpm install –save-dev gulp

A gulpfile is a file in your project directory titled gulpfile.js (or capitalized as Gulpfile.js, like Makefile), which automatically loads when you run the gulp command. Within this file, you'll often see gulp APIs, like src(), dest(), series(), or parallel() but any vanilla JavaScript or Node modules can be used. Any exported functions will be registered into gulp's task system.


// example 1const { series, parallel } = require('gulp');function clean(cb) {  // body omitted
  cb();}function cssTranspile(cb) {  // body omitted
  cb();}function cssMinify(cb) {  // body omitted
  cb();}function jsTranspile(cb) {  // body omitted
  cb();}function jsBundle(cb) {  // body omitted
  cb();}function jsMinify(cb) {  // body omitted
  cb();}function publish(cb) {  // body omitted
  cb();}exports.build = series(
  clean,
  parallel(
    cssTranspile,
    series(jsTranspile, jsBundle)
  ),
  parallel(cssMinify, jsMinify),
  publish);

// example 2const { watch, series, parallel } = require('gulp');function clean(cb) {  // body omitted
  cb();}function css(cb) {  // body omitted
  cb();}function javascript(cb) {  // body omitted
  cb();}//exports.build = series(clean, parallel(css, javascript));exports.default = function() {
  watch('src/*.css', css);  // single task
  watch('src/*.js', series(clean, javascript));  // composed};

To run Gulp:

gulp

There are 4118 Gulp plugins at the time of writing.