I have a gulp task that look like this:
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'));
});
This gulp task uses:
- gulp-uglify
- gulp-wrap
- gulp-concat
- gulp-sourcemaps
Everything above is running properly. But then I found that gulp-uglify
seems to come with it's own wrap
function. How can I use gulp-uglify
function to wrap the script?