正如文档所说,它们都处理将非流插件转换为流。
我试图理解的是,如果我可以.pipe()
在某些东西上使用该方法,这是否意味着它是一个流?
如果是这样,我在这里转换成什么?
乙烯基源流示例:
(来自:https ://www.npmjs.com/package/vinyl-buffer )
var browserify = require('browserify')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var uglify = require('gulp-uglify')
var size = require('gulp-size')
var gulp = require('gulp')
gulp.task('build', function() {
var bundler = browserify('./index.js')
return bundler.pipe()
.pipe(source('index.js'))
.pipe(buffer()) // <---------------------- why?
.pipe(uglify())
.pipe(size())
.pipe(gulp.dest('dist/'))
})
吞咽流化示例:
(来自:https ://www.npmjs.com/package/vinyl-source-stream )
var source = require('vinyl-source-stream')
var streamify = require('gulp-streamify')
var browserify = require('browserify')
var uglify = require('gulp-uglify')
var gulp = require('gulp')
gulp.task('browserify', function() {
var bundleStream = browserify('index.js').bundle()
bundleStream
.pipe(source('index.js'))
.pipe(streamify(uglify())) // <----------- why?
.pipe(gulp.dest('./bundle.js'))
})