简体   繁体   English

gulp uglify输出min.js

[英]Gulp uglify output min.js

The js file being compressed is output with the same filename. 正在压缩的js文件以相同的文件名输出。

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? 我怎么能让它输出后面的min.js文件?

You can use the suffix or extname parameters of gulp-rename like: 您可以使用gulp-renamesuffixextname参数,如:

gulp.task('compressjs', function () {
  gulp.src('app/**/*.js')
    .pipe(uglify())
    .pipe(rename({ suffix: '.min' }))
    .pipe(gulp.dest('dist'))
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM