I use Cordova with two platforms ios and android. When I change something in my
Project/config.xml
it will be merged into
Pro
Since I have not yet found a better way, I suggest saving the config.xml files as you want them in some other location, and writing a script which does a cordova prepare
, then copies the config.xml file to where it should go before compiling, and then have it run cordova compile
. cordova buld
just does a cordova prepare
followed by a cordova compile
, so a script that does this copying between these two steps is equivalent to a cordova build
, but one which preserves your custom files.
If you are using the xcode IDE, you can add a pre-action script to the iOS project's build:
And for the script you can enter:
cordova prepare
After that, doing a build from inside xcode will refresh your common code files, preserve your edits to files, and do a build.
This is clearly a workaround, but it does have the virtue that you can copy different versions of config.xml and of any other files into different platform directories.
One caveat of this is that you must be careful whenever you do something with the Cordova tools which make changes to config.xml or any other file you are preserving through a prepare that you would want to keep. In particular, you must remember to update your custom config.xml file whenever you add or remove a plugin.
I hope the Cordova tool developers either add support for this kind of reasonable desire, or improve the documentation if it actually is already supported, because this.