jeudi 16 avril 2015

Gulp-uglify combine multiple javascript files into a single javascript file

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 so for to simulte it:



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'))).


Aucun commentaire:

Enregistrer un commentaire