Disable uglify in Gulpfile

Gulp is uglifying angular dependencies and causing errors, how do I tell it not to uglify certain files?

Also, Can a “gulp” category be added?

You should be using https://github.com/Kagami/gulp-ng-annotate/blob/master/README.md

1 Like

Worked great! Thanks.

For posterity: The thing in Uglify that breaks angular is the mangler. You can disable mangling in uglify but I would not recommend it. Most of the actual runtime perf benefits of uglifying comes from mangling. So that’s why I recommend using ng-annotate. Definitely always recommend using ngStrictDi if you are on 1.3.

[ngScriptDi] if this attribute is present on the app element, the injector will be created in “strict-di” mode. This means that the application will fail to invoke functions which do not use explicit function annotation (and are thus unsuitable for minification), as described in the Dependency Injection guide, and useful debugging info will assist in tracking down the root of these bugs.


Hi, I am trying to use angular js on a project that I am playing around with based on Sage.

Sorry I am new to gulp and Roots/Sage, but familiar with angular/word press and have used grunt a little bit.

I have a recent version of Sage.

I am getting “Unknown provider: tProvider <- t <- mainController”

if i comment out .pipe($.uglify) in gulpfile.js its fine.

I have installed gulp-ng-annotate but not sure what i need to do get it doing its magic.

Im guessing i need to modify a few processes in gulpfile.js, but not really sure were to begin apart form adding:

var ngAnnotate = require('gulp-ng-annotate');

Any help would be greatly appreciated, please elaborate as much as possible as your dealing with a bit of a newbie.






my jsTasks looks like this:

var jsTasks = function(filename) {
  return lazypipe()
  .pipe(function() {
    return $.if(enabled.maps, $.sourcemaps.init());
  .pipe($.concat, filename)
  .pipe(function() {
    return $.if(enabled.rev, $.rev());
  .pipe(function() {
    return $.if(enabled.maps, $.sourcemaps.write('.'));

Thanks, that has worked perfect and thanks for being very clear

anyways is there a “clean” way to disable uglify? i commented it out in gulpfile now.

Hide it behind a flag