README.adoc

May 13, 2016 ยท View on GitHub

:version: 2.4.1 :apVersion: 2.5.0 :ngAnnotateVersion: 1.2.1 = AngularJs Annotate Asset-Pipeline

The angular-annotate-asset-pipeline is an https://github.com/bertramdev/asset-pipeline-core[Asset Pipeline] module that provides annotations for dependecy injection to allow angular JavaScript or CofeeScript files to be minified in Gradle and Grails projects.

== Getting started

=== Gradle / Grails 3

[source,groovy,subs='attributes'] .build.gradle

plugins { id 'com.bertramlabs.asset-pipeline' version '{apVersion}' }

dependencies { assets 'com.craigburke.angular:angular-annotate-asset-pipeline:{version}' }

=== Grails 2 Add the plugin to your BuildConfig.groovy:

[source,groovy,subs='attributes'] .BuildConfig.groovy

plugins { runtime ":angular-annotate-asset-pipeline:{version}" }

== How it works

Since the parameter names are significant for AngularJS to do dependency injection and most minifiers rename parameters, you have to use inline annotations. See https://docs.angularjs.org/tutorial/step_05[A Note on Minification]

This plugin uses https://github.com/olov/ng-annotate[ng-annotate v{ngAnnotateVersion}] to add those inline annotations and make your angular files safe to minify.

For example this

[source,javascript]

function IndexController(scope) { scope.message = "Hello world"; };

Will be automatically annotated like so:

[source,javascript]

function IndexController(scope) { scope.message = "Hello world"; }; IndexController.inject=["inject = ["scope"];

== Contributions Thank you to the following people who have made major contributions to this module in terms of both feedback and code: