Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova install platforms/plugins from config.xml

In Cordova, it is possible to save platforms and plugins into the config.xml file, this way :

cordova platform add <platform> --save
cordova plugin add <plugin> --save

This is usefull for versioning in order to not commit all this generated files.

But... how can I install them back from config.xml ?

Something like : cordova platform add --source=config.xml ?

like image 509
Vincent Wasteels Avatar asked Oct 13 '15 07:10

Vincent Wasteels


People also ask

How do I add a plugin to config xml Cordova?

When adding plugins or platforms, use the --save flag to add them to config. xml. Ex: cordova platform add android --save. Existing projects can use cordova plugin save and cordova platform save commands to save all previously installed plugins and platforms into your project's config.

What is the role of config XML file of Cordova project?

config. xml is a global configuration file that controls many aspects of a cordova application's behavior. This platform-agnostic XML file is arranged based on the W3C's Packaged Web Apps (Widgets) specification, and extended to specify core Cordova API features, plugins, and platform-specific settings.


3 Answers

Upd: Official docs on this topic: http://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/index.html

Here is some docs on this feature from Tools Release: April 21, 2015:

When adding plugins or platforms, use the --save flag to add them to config.xml.

Ex: cordova platform add android --save.

Existing projects can use cordova plugin save and cordova platform save commands to save all previously installed plugins and platforms into your project's config.xml.

Platforms and plugins will be autorestored when cordova prepare is run. This allows developers to easily manage and share their dependenceis among different development enviroments and with their coworkers.

like image 95
daserge Avatar answered Oct 20 '22 00:10

daserge


To install all plugins from the config.xml file you run:

cordova prepare

Check what plugins are loaded with:

cordova plugin list

like image 44
Adam Avatar answered Oct 19 '22 23:10

Adam


Apparently running a command like cordova serve will automatically add all missing platforms/plugins !

like image 1
Vincent Wasteels Avatar answered Oct 19 '22 23:10

Vincent Wasteels