The angular-annotate-asset-pipeline
is an Asset Pipeline module that provides annotations for dependecy injection to allow angular JavaScript or CofeeScript files to be minified in Gradle and Grails projects.
plugins {
id 'com.bertramlabs.asset-pipeline' version '2.5.0'
}
dependencies {
assets 'com.craigburke.angular:angular-annotate-asset-pipeline:2.4.1'
}
Since the parameter names are significant for AngularJS to do dependency injection and most minifiers rename parameters, you have to use inline annotations. See A Note on Minification
This plugin uses ng-annotate v1.2.1 to add those inline annotations and make your angular files safe to minify.
For example this
function IndexController($scope) {
$scope.message = "Hello world";
};
Will be automatically annotated like so:
function IndexController($scope) {
$scope.message = "Hello world";
};
IndexController.$inject = ["$scope"];
Thank you to the following people who have made major contributions to this module in terms of both feedback and code:
-
Eric Brayeur - @asteria277
-
David Estes - @davydotcom