I like to automate my processes, I like to have three distinct branches of my code. I'm developing an Ionic Framework based application however, I'd like to have configurations such as the server to connect to be changed based on a passed in parameter.
In C++ I can setup DEFINES which I can then use in the code to control various configurations. Does the Ionic Build system have a similar functionality?
Yes - you can use Hooks.
Hooks let you add a middleware functionality during the build phaze and are built with JavaScript.
There's a hook you can use to replace text on configuration files -
Create a configuration file with tokens per env
{
"stage":
{
"datahostname" : "'qa-api.mydomain.com'"
},
"prod":
{
"datahostname" : "'api.mydomain.com'"
}
}
Put your token spread in files you want to make replacement at
build with traget variable
TARGET=prod cordova build ios
check out this article to extend knowledge