I'm searching for Gulp task that can take multiple javascript files into a single javascript file and compress to one file, like grunt-contrib-uglify.
This what I tried to do so for to simulate grunt-contrib-uglify:
gulp.task('compressJS', function ()
{
return gulp.src(SomeJSArrayWithALotOfFiles)
.pipe(concat('application.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('../application'))
}
My problem with this solution:
I need manually delete the file (application.js.min) before I run the task, otherwise every task execution the new files concatenate to old compressed file (because this line: .pipe(concat('application.js')
)).