Gulp uglify output min.js

GulpGulp Uglify

Gulp Problem Overview


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?

Gulp Solutions


Solution 1 - Gulp

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'))
})

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1995781View Question on Stackoverflow
Solution 1 - GulpPreviewView Answer on Stackoverflow