cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Kinard <>
Subject Re: Questions re: plugin variables
Date Fri, 07 Nov 2014 14:41:31 GMT
If there is a reasonable question from a user, it should probably be added to the docs (assuming
it's not already there).

Leo, would you like to do a pull request?

On Nov 5, 2014, at 8:24 PM, Mark Koudritsky <> wrote:

> Variables should to be provided when adding the plugin
> E.g:
>    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 <>
> wrote:
>> 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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message