3
我有这个样子一饮而尽任务:咕嘟咕嘟-丑化包装JS
gulp.task('compressjs', function() {
gulp.src('local/**/*.js')
.pipe(sourcemaps.init())
// purpose compress here is only to give better error report
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(wrap('(function(){"use strict"; <%= contents %>\n})();'))
// compress here to get best final compression
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/app'));
});
这一口任务使用:
- 一饮而尽,丑化
- 一饮而尽,包裹
- gulp- concat
- gulp-sourcemaps
上面的所有内容都正常运行。但后来我发现gulp-uglify
似乎与它自己的wrap
功能。我如何使用gulp-uglify
函数来包装脚本?