Question

To compress js files via gulp I have tried using both gulp modules

but it changes the variable I define.

for eg:

var app = angular.module('myApp', [])
    .config(function($interpolateProvider){
        $interpolateProvider.startSymbol('{[').endSymbol(']}');
    });

is compressed to:

var app = angular.module("myApp",[])
    .config(function(n){n.startSymbol("{[").endSymbol("]}")});

while using Angularjs with Twig I have to change the mustaches {{ }} to {[ ]} and the angularjs doesn't recognize the n instead of $interpolateProvider.

Any suggestions how to tell uglifyjs not to change my variables while compression?

Was it helpful?

Solution

This is when you need to include ng-min task into your build as well as it will protect your angular from minification problems.

Or by hand, but thats just silly...

var app = angular.module('myApp', []).config(['$interpolateProvider', function($interpolateProvider){
        $interpolateProvider.startSymbol('{[').endSymbol(']}');
    }
]);

Some docs on Angular minification issues scroll down to 'A Note on Minification.'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top