gulp Anatomy of a gulp function


Example

[Function <name>] (glob) {

$.src(glob)

.pipe([plugin 1])
.pipe([plugin 2])
.
.
.
.pipe([plugin n])
.pipe( $.dest(<destination-name>)

}

Note

pipe is a method that streams all the files matching the glob input , to our plugins( minifyhtml in this case) .

It is simple to picture it like so:

$.src is what builds the stream and pipe pipes out each individual file matching the glob downwards to each plugin in the pipeline.Each plugin the file is passed to , modifies its contents in memory only until $.dest is reached , which then updates/creates files streamed by $.src

Where ,

$ - > gulp

$$ - > gulp-load-plugins