I'm looking to minimize some JavaScript code that includes classes, but unfortunately, the current version of gulp-uglify
doesn't support this feature as discussed in this thread.
I followed the advice given previously and installed
npm install uglify-js-harmony --save-dev
, but as a beginner in front-end development, I'm unsure how to pass my source through it like I could with gulp-uglify
.
Here's what I have so far:
var uglify = require('uglify-js-harmony');
// ...
gulp.task('scripts', function(){
return gulp.src(bower().concat(jsFiles))
.pipe(plumber())
.pipe(concat('main.min.js'))
.pipe(uglify())
.pipe(gulp.dest(dest + 'js'))
.pipe(reload({stream:true}))
});
However, I keep getting an error message saying
[17:42:40] TypeError: uglify is not a function
, and I'm stuck on how to proceed. Any guidance would be appreciated. Thank you.