Generates cordova config.xml file
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-cordova-config --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-cordova-config');
In your project's Gruntfile, add a section named cordova_config
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
cordova_config: {
my_target: {
options : {
id : 'com.example.hello',
version : '1.0.0',
// ...
},
dest : 'path/to/config.xml
}
},
})
Type: String
Default value: com.example.hello
Type: String
Default value: 0.0.1
Type: String
Default value: HelloWorld
Type: String
Default value: A sample Apache Cordova application that responds to the deviceready event.
Type: String
Default value: Apache Cordova Team
Type: String
Default value: [email protected]
Type: String
Default value: http://cordova.io
Type: String
Default value: index.html
Type: String
Default value: *
Type: Array
Example:
preferences: [
{
name : 'fullscreen',
value: true
},
{
name : 'webviewbounce',
value: false
},
...
Default value: []
Type: Array
Example:
features : {
name : 'StatusBar',
params: [
{
name : 'ios-package',
value : 'CDVStatusBar',
onload: true
}
]
}
Default value: []
In this example, the default options are used to generate config.xml file. The result will be the same as after cordova create
command
grunt.initConfig({
cordova_config: {
my_target : {
dest: 'cordova-project/www/config.xml'
}
},
})
grunt.initConfig({
cordova_config: {
options: {
id: 'com.example.application',
name: 'app name',
author : {
name : 'First Last',
email : '[email protected]'
},
preferences: [
{
name : 'fullscreen',
value: true
},
{
name : 'webviewbounce',
value: false
},
{
name : 'UIWebViewBounce',
value: false
},
{
name : 'DisallowOverscroll',
value: true
},
{
name : 'BackupWebStorage',
value: 'none'
}
],
features : [
{
name : 'StatusBar',
params: [
{
name : 'ios-package',
value : 'CDVStatusBar',
onload: true
}
]
}
]
},
dest : 'cordova-project/www/config.xml'
}
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2014 Andrey Shustariov. Licensed under the MIT license.