Uglify angular.js together with codebase for further obfuscation

728 Views Asked by At

I'm trying to obfuscate my Ionic code. Every question or post about uglifying angular.js code, tells that you should use annotated syntax for dependency injection, something that after obfuscation looks like this:

angular.module('App')
.controller('MyCtrl', ['$scope', '$state', function(a,b) { ...}])

But I'd like to experiment with not using this approach and still obfuscating the code by including angular.js in the obfuscation phase, so that angular providers would also be mangled and the code would look like this:

angular.module('App')
    .controller('MyCtrl', function(aX,bZ) { ...}])

Where (following the first example) aX is the mangled name for $scope and bZ correspond to the $state provider.

This approach would make it harder for someone who knows AngularJS trying to understand your code, since angular.js is also obfuscated (I mean, providers lost their original meaningfull names).

I have joined ionic.js + angular.js + myfiles.js and passed that thru Uglify2, but only got errors on running the app, mostly related to the angular injector service, but also about window been undefined and the like.

Has anyone done that before? Any working examples?

0

There are 0 best solutions below