有没有一种方法可以自定义的JavaScript minfier /捆扎机随.NET 4.5(Microsoft.Web.Optimization)各种微小选项的输出?例如,我想允许本地变量重命名,但不允许函数参数重命名。
Is there a way to customize the output of the JavaScript minfier/bundler that comes with .NET 4.5 (Microsoft.Web.Optimization) with various minification options? For example, I want to allow local variable renaming but not allow function argument renaming.
作为背景,我想引入一个AngularJS应用程序到.NET应用程序,并希望能够利用捆绑/缩小框架自带.NET 4.5。我不希望函数参数重命名为发生,因为AngularJS使用的参数名做依赖注入。
As a background, I'm trying to introduce an AngularJS app into a .NET application, and want to be able to use the bundling/minification framework that comes with .NET 4.5. I don't want function argument renaming to happen since AngularJS uses the argument names for doing dependency injection.
AngularJs已经可以建立时如何处理,对于您通过 []
语法选项控制器
或其它角度服务
AngularJs already can handle that for you via the []
syntax option when building up controllers
or other angular services
app.controller("MyCtrl", function($scope, $http){});
变为
app.controller("MyCtrl", ["$scope", "$http", function($scope, $http){
}];
,或通过 $注
var myCtrl = function($scope, $http){};
myCtrl.$inject = ['$scope', '$http'];
这样做可以让角要知道即使在JS被缩小的注入哪件。
Doing this allows Angular to know which pieces to inject even when the js is minified.