How to minify ES6 functions with gulp-uglify?

You can leverage gulp-babel as such… const gulp = require(‘gulp’); const babel = require(‘gulp-babel’); const uglify = require(‘gulp-uglify’); gulp.task(‘minify’, () => { return gulp.src(‘src/**/*.js’) .pipe(babel({ presets: [‘es2015’] })) .pipe(uglify()) // […] }); This will transpile your es6 early in the pipeline and churn out as widely supported “plain” javascript by the time you minify. May … Read more

Gulp-uglify : throw er; // Unhandled ‘error’ event

Your uglify task is probably choking on one of the files it is trying to process. Handle the error and write the output to the console so you can see which file causing the task to fail. gulp.task(‘scripts’, [‘clean’], function () { return gulp.src(‘js/*.js’) .pipe(uglify().on(‘error’, function(e){ console.log(e); })) .pipe(gulp.dest(‘minjs’)); }); When you run your gulp … Read more

Gulp uglify output min.js

You can use the suffix or extname parameters of gulp-rename like: gulp.task(‘compressjs’, function () { gulp.src(‘app/**/*.js’) .pipe(uglify()) .pipe(rename({ suffix: ‘.min’ })) .pipe(gulp.dest(‘dist’)) })

Uglify SyntaxError: Unexpected token: punc ())

// Update From the comments ~ @imolit  v2.0.0 (2018-09-14) – BREAKING CHANGES (link) Switch back to uglify-js (uglify-es is abandoned, if you need uglify ES6 code please use terser-webpack-plugin). Original answer before the update… I hope you can get inspired by this solution which works with webpack. (link below) Simply teach UglifyJS ES6 There are two … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)