const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
const source = require('vinyl-source-stream');
const browserify = require('browserify');
gulp.task('build', () =>
browserify('./src/app.js').bundle()
.pipe(source('app.js'))
.pipe(gulp.dest('./build')) // OK. app.js is saved.
.pipe($.rename('app.min.js'))
.pipe($.streamify($.uglify())
.pipe(gulp.dest('./build')) // Fail. app.min.js is not saved.
);
Piping to multiple destinations when file.contents is a stream is not currently supported. What is a workaround for this problem?
See Question&Answers more detail:os