1

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?

1 Answer 1

3

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.'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.