Utility for creating a JS config for angular using constants, using a list of input files.
Install via npm install angular-write-constants
.
angular-write-constants --module moduleName primary.json secondary.json ... > config.js
Example contents:
primary.json
:
{
"answerToEverything": 42,
"overriddenValue": "someOldValue"
}
secondary.json
:
{
"overriddenValue": "someNewValue",
"apiEndpoint": "https://google.com/"
}
Resulting config.js
:
angular.module("moduleName")
.constant("ANSWER_TO_EVERYTHING", 42)
.constant("OVERRIDDEN_VALUE", "someNewValue")
.constant("API_ENDPOINT", "https://google.com/");
MIT