Gulp uglify breaking angular application

Justin picture Justin · Jun 26, 2014 · Viewed 8.6k times · Source

When trying to use gulp-ugily with my angular application, it is breaking, even though I am running it through gulp-ngmin.

Here is the gulp file:

var gulp = require('gulp'),
    concat = require('gulp-concat'),
    ngmin = require('gulp-ngmin'),
    uglify = require('gulp-uglify');

gulp.task('compress', function() {
    gulp.src('client/js/source/*.js')
        .pipe(concat('app.js'))
        .pipe(ngmin())
        .pipe(uglify())
        .pipe(gulp.dest('client/js'));
});

Answer

beauXjames picture beauXjames · Jan 22, 2015

It helps to disable the mangle option in uglify, for it's messing with all the injection stuff and naming.

.pipe(uglify({ mangle: false }))