问题
It is possible minify js files without add -min suffix?
I want keep original name.
gulp.task("js-external-release", function() {
gulp.src(config.vendorJs)
.pipe(minify())
.pipe(gulp.dest(config.dist + "/scripts"));
});
回答1:
Use gulp-uglify instead - it doesn't rename files, which is the default behavior for most gulp plugins.
var gulp = require('gulp');
var uglify = require('uglify');
gulp.task("js-external-release", function() {
gulp.src(config.vendorJs)
.pipe(uglify())
.pipe(gulp.dest(config.dist + "/scripts"));
});
Alternatively, you could use gulp-rename, but switching to uglify
will eliminate the need for such a plugin and is less complex than adding a new plugin in my opinion.
来源:https://stackoverflow.com/questions/33881413/gulp-minify-without-rename-original-files