AngularJS : automate process to minify project

元气小坏坏 提交于 2019-12-24 15:26:28

问题


I have this interest in automate/simplify angular project with a compiler tool, which might work on everything else, but angular inject and namespacing is awkward enough to escape compiler knowledge. What is the best/professional method for doing this?

thanks, just one last thing,

app.controller('ctrl',['$rootScope',function($rootScope){
    ...
}]);

works when minified, but how do I minify

app.config(['$routeProvider', function($routeProvider){

}]);

and does it work when I minify successive actions?

app.controller(...).directive(...).run(...)

回答1:


Check the ngmin (https://github.com/btford/ngmin) to automatically add Dependency-Injection annotations to AngularJS project. After this is done you should be able to use any JavaScript minifier.




回答2:


For each method you are chaining, use the brackets - exactly like you thought.

app.config(['$routeProvider', function($routeProvider){ }]).run(['$http', '$rootScope',  function($http, $rootScope){ }]);


来源:https://stackoverflow.com/questions/15706972/angularjs-automate-process-to-minify-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!