gulp-uglify icon indicating copy to clipboard operation
gulp-uglify copied to clipboard

Task not compressing

Open rbiggs opened this issue 7 years ago • 3 comments
trafficstars

I'm trying to use gulp-uglify to compress es6 code (not es5). I have the following task, but nothing happens:

const compress = require('gulp-uglify')

gulp.task('compress', function() {
  gulp.src('./js.app.js')
    .pipe(compress({
      compress: {
        collapse_vars: true
      },
    }))
    .pipe(gulp.dest('./js'))
})
//...
gulp.task('default', ['compress', 'serve', 'watch'])

This worked with the rollup-uglify plugin, but that doesn't support es6 minification.

rbiggs avatar Sep 14 '18 03:09 rbiggs

You need to return from the Gulp task.

terinjokes avatar Sep 14 '18 04:09 terinjokes

Hmm... So:

gulp.task('compress', function() {
  return gulp.src('./js.app.js')
   .pipe(compress({
      compress: {
        collapse_vars: true
      },
    }))
    .pipe(gulp.dest('./js'))
})

That does nothing as well.

rbiggs avatar Sep 14 '18 05:09 rbiggs

Tried following the suggestion in the README of usingpump so you can get error messages?

terinjokes avatar Sep 14 '18 11:09 terinjokes