When I run gulp scripts
, both all.js and all.min.js end up minified. Anybody know why this happens?
gulp.task("scripts", function() {
var concatted = gulp.src(['js/first.js', 'js/second.js'])
.pipe(concat('all.js'));
// output concatenated scripts to js/all.js
concatted.pipe(gulp.dest('js'));
// minify concatenated scripts and output to js/all.min.js
concatted.pipe(uglify())
.pipe(rename('all.min.js')
.pipe(gulp.dest('js'))
});
The problem is here
You aren't returning the modified stream into
concatted
.You could change this to
but this also works as expected