Generates an angular module from a json config file
Install the plugin via npm with npm install [email protected]:pankratios/ng-config-brunch.git
.
Import external data through the imports
section.
{
...
plugins: {
ngconfig: {
imports: [
'./package.json',
'./bower.json'
]
}
}
}
The imported data can be accessed with {{...}}
notation.
{
"packageVersion": "{{=it.package.version}}"
"bowerVersion": "{{=it.bower.version}}"
}
Configurations can be overriden per environment
, development
is the default.
*.conf.json
{
"moduleName": "myApp.config",
"values": {
"appName": "App name is {{=it.bower.name}}",
},
"constants": {
"appVersion": "version {{=it.package.version}}",
"requestTimeout": 3000
},
"overrides": {
"production": {
"constants": {
"requestTimeout": 1000
}
}
}
}
development env
angular
.module("myApp.config", [])
.constant("appVersion", "version 1.0.9")
.value("appName", "App name is angular-config-example")
.constant("requestTimeout", 3000)
production env
angular
.module("myApp.config", [])
...
.constant("requestTimeout", 1000)