One semi-useful example is to think of pulling a fire with a bucket of water. To put out a fire, you would like to completely fill the bucket before dropping it onto the fire by putting a few drops in the bucket, and then discard a lot of drops over time on the fire. This metaphor does not capture everything, but the big idea is this: you need a FULL bucket of water before you can put out the fire.
This uglify plugin works the same way. Imagine some huge JS file that you want to compress / guess.
It will take a little time to load the entire code base, and you definitely will not want to try to minimize each line as it is, right? Imagine that you load one line, reduce it, load another line, reduce it, etc. - it will be a mess. You cannot pass it (you need a full βbucketβ of code before you can guess it.) To properly remove this file, you will need to download all this code before trying to guess it.
Since Gulp is a "streaming" build system, you cannot use uglify unless you have a mechanism to turn a stream into a buffer (& when it issues a stream). Both of the tools you mentioned make this possible.
Here's the stream: STREAM> (BUFFER)> {do some work on the entire "buffered" file}> STREAM> {other Gulp work, etc.}
For your specific question, you can use .pipe (), because virtual-buffer / gulp -streamify help "converts" streams to buffers, and then buffers to streams. They are different approaches to doing essentially the same thing.
Victor Aug 10 '16 at 21:21 2016-08-10 21:21
source share