Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Use different config.xml in development and production environment

Notifications You must be signed in to change notification settings

arzyu/cordova-plugin-config-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-config-helper

Generate config.xml before cordova prepare.

Features:

  • sync version from package.json to config.xml
  • set content url for <content src="..." />, it works perfectly with webpack-dev-server

Installation

cordova plugin add cordova-plugin-config-helper

Usage

package.json:

{
  "name": "my-app",
  "version": "1.0.0",
  "scripts": {
    "start": "NODE_ENV=development cordova run android",
    "build": "cordova build android"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-config-helper": {
        "TEMPLATE": "config.tpl.xml",
        "DEV_HOST": "",
        "DEV_PORT": "3000",
        "INDEX": "index.html"
      }
    }
  }
}

config.tpl.xml:

<widget id="com.sample.app" version="${version}" ...>
  <content src="${url}" />
  ...
</widget>
  • npm start, generate config.xml for development
  • npm run build, generate config.xml for production

Tips: You should add config.xml to .gitignore.

About

Use different config.xml in development and production environment

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published