64

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?

Preview
  • 35,317
  • 10
  • 92
  • 112
user1995781
  • 19,085
  • 45
  • 135
  • 236

1 Answers1

129

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'))
})
Preview
  • 35,317
  • 10
  • 92
  • 112