Search code examples
javascriptangularjsminifyuglifyjs

Angularjs minification being forced to add strings for services


As is documented in numerous places in angular you must put service names in an array in order to survive minification.

example: Different kind of Angular Directives patterns

The problem I have with this is that it's really really ugly and you have to essentially put the service names twice. I also don't want to turn off mangling in uglifyjs.

Is there a way to automatically create the brackets in the build process or use some other method to take care of this problem automatically?


Solution

  • You can try ngmin - https://github.com/btford/ngmin.

    But I prefer to add these annotations manually by myself.