Support for components wrapped in IIFE
srigi opened this issue · 2 comments
There is a support for ngmining of refenced modules as mentioned in doc:
var myMod = angular.module('myMod', []);
myMod.service('myService', function($scope) {});
By using this method myMod
leak into global scope (most AngularJS apps don't use AMD, mine too), so I'm not using it. I also don't use chained way of source, cos I don't like it.
However, as I'm using CoffeeScript, I explored really nice way of isolating modules like this:
do(module = angular.module('myMod', [])) ->
module.service('myService', ($scope) ->
# do something
This yields nicely isolated component with this JS code:
(function (module) {
return module.service('myService', function ($scope) {
// do something
});
}(angular.module('myMod')));
Of course this is not recognized by ngmin
. I would much appreciate if ngmin
will support this syntax. That do
call in CfS looks like namespacing schema implemented by Angular's module system, so I really like it.
I'm not especially keen on implementing support for this myself, but I'd be willing to review and possibly merge a PR for the feature.
Please try https://github.com/olov/ng-annotate. ngmin is now deprecated: #93
If your issue isn't resolved there please open an issue at https://github.com/olov/ng-annotate/issues
If you really want ngmin to fix this issue, feel free to fork it and use that.