cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Koudritsky <>
Subject Re: Questions re: plugin variables
Date Thu, 06 Nov 2014 01:24:47 GMT
Variables should to be provided when adding the plugin

    cordova plugin add org.some.plugin --variable API_KEY=some_value

Example of a plugin that uses variables:

Relevant places in the code in cordova-lib:
   Where variables are checked during plugin add:

Here each variable is replaced with its value when generating the "config
munge" which is an object that describes changes that need to be applied to
the platform dir.

On Wed, Nov 5, 2014 at 5:28 PM, Treggiari, Leo <>

> I'm having a hard time understanding exactly how plugin variables work.
> It's probably a level of detail that only plugin developers and tool
> developers need to be concerned about.  I'd appreciate it if someone can
> give me the answers.
> 1.  "variables can be indicated by a dollar-sign followed by a series of
> capital letters, digits, or underscores."
>      "To make the variable mandatory, the <platform> tag needs to contain
> a <preference> tag."
>      Does this mean that there are optional and required variables - i.e?
>       -  A variable reference is defined by a lexical element which begins
> with a $ and is followed only by capital letters, digits, or underscores?
>       -  A variable is made mandatory by the presence of a <preference>
> tag which uses the same name with the $ removed?
>       -  Can this <preference> tag be anywhere in the plugin.xml file, or
> must it be the direct child of the <plugin> element or
>          a <platform> element?
>       -  Can the variable references be anywhere or only within strings?
> 2.  Where and when are the variables replaced by their value?
>       -  plugin.xml is the only place that the variable value is used and
> only for replacing the variable references?
>       -  When in Cordova CLI do the values get applied - during "add",
> during "prepare"?
> 3.   What happens if you combine dependencies with variables.  For
> example, suppose A depends on B, and B requires a variable X.  How do you
> supply the value?
> Thanks,
> Leo

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message