lundi 23 février 2015

what are the propose on vinyl-buffer and gulp-streamify in gulp?


as the documentation says, they both deals with transforming non stream plugins to stream. but what I try to understand is if if I can I use the .pipe() method on something, isn't it mean that it's a stream? if so, what I convert what here?


vinyl-source-stream example:


(from: http://ift.tt/1EoInyw)



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 doing it?
.pipe(uglify())
.pipe(size())
.pipe(gulp.dest('dist/'))
})


gulp-streamify example:


(from: http://ift.tt/1EoInyy)



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 doing it?
.pipe(gulp.dest('./bundle.js'))
})




Aucun commentaire:

Enregistrer un commentaire