guzart / gulp-ng-constant

Gulp plugin for dynamic generation of angular constant modules.
MIT License
109 stars 26 forks source link

Adding option to group constants under one constant name. See issue #38. #35

Open alajmo opened 8 years ago

alajmo commented 8 years ago

Hi,

I didn't find the possibility to group under one single constant name.

Example

Given an object like:

{
 "person": "samir",
 "age": 99
}

I wanted to get this:

angular.module("conf", [])
.constant("CONFIG", {
 "person": "samir",
 "age": 99
});

but instead got this:

angular.module("conf", [])
.constant("person", "samir")
.constant"age", 99);

Using an optional parameter we can simply group the whole object under a user defined constant.

Let me know if you think this feature makes sense and I'll write the tests and update README to include an example (I just added the option explanation for now).

ViieeS commented 6 years ago

@guzart how about to merge it?