Gulp uglify output min.js
The js file being compressed is output with the same filename.
gulp.task('compressjs', function () {
gulp.src('app/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
How can I have it output the file with min.js
at the back?
Solution 1:
You can use the suffix
or extname
parameters of gulp-rename like:
gulp.task('compressjs', function () {
gulp.src('app/**/*.js')
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('dist'))
})