Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
7.0.0
-
None
-
None
Description
Hi,
in my cordova plugin, I am trying to edit the resulting android apps `colors.xml` file. Unfortunately, by default the android app cordova creates does not have a `colors.xml` file - this means the following code does nothing, as a non existent file is simply ignored (without warning or error).
<config-file target="./res/values/colors.xml" parent="/resources"> <color name="my-color">#F00000</color> </config-file>
What I tried instead now was first creating the file by simply copying over an empty one with the `resource-file` directive and then editing it, resulting in a plugin.xml like the following:
<resource-file src="path/to/colors.xml" target="app/src/main/res/values/colors.xml" /> <config-file target="./res/values/colors.xml" parent="/resources"> <color name="my-color">#F00000</color> </config-file>
The file is copied to the correct place, but still not modified. I am guessing that `config-file` is somehow executed earlier than `resource-file`.
Also if I simply add my color to strings.xml, it works flawlessly - because the android app build with cordova does indeed contain a strings.xml by default.
What I would like to achieve now is either
a) make the `config-file` directive lazily create the colors.xml if it doesn't exist
b) create an empty colors.xml and fill it with the `config-file` directive
Any ideas are welcome!