Extend AngularJS applications by injecting module dependencies at build time
Extend AngularJS applications by injecting module dependencies at build time (using static code transformations).
For example transforms this:
Nowadays having a project using Grunt (or any other similar tool) for workflow automation and asset management is not uncommon. So the idea with this small library is to provide a way to implement a simple plugin system for AngularJS applications using only static code transformations. This has two main advantages (compared to extending the module with dynamic tricks):
The main use case for such a system is when you have an AngularJS based application and you want to allow third party modules (plugins) to exend you core app without hardcoding those new dependencies.
var angularExtend = ;var src = "angular.module('moduleName', ['aModule']);";var res = ;/*res.out will be:angular.module('moduleName', ['aModule', "aPlugin"]);res.changed is a boolean and will tell if any extension was applied at all.*/
A grunt plugin using this library will be soon available at https://github.com/mariocasciaro/grunt-angular-extender
The transformation will work only if you follow the convention of delaring modules like
Using variables or functions to define the module name, will fail.