markmarijnissen / webpack-cordova-plugin

Output webpack to a Cordova app.
65 stars 20 forks source link

webpack-cordova-plugin

Output webpack to a Cordova app.

Usage

var CordovaPlugin = require('webpack-cordova-plugin');

new CordovaPlugin({
  config: 'config.xml',  // Location of Cordova' config.xml (will be created if not found)
  src: 'index.html',     // Set entry-point of cordova in config.xml
  platform: 'ios', (or 'android') // Set `webpack-dev-server` to correct `contentBase` to use Cordova plugins.
  version: true,         // Set config.xml' version. (true = use version from package.json)
});

Getting started

  1. Install cordova and the webpack-cordova-plugin

    npm install -g cordova 
    npm install --save-dev webpack-cordova-plugin
  2. Add the plugin to your webpack.config.js

  3. Run webpack. It wil automatically create the Cordova config.xml.

  4. Modify the app bundle ID in config.xml

  5. Launch cordova!

    cordova platforms add ios # or android
    cordova run ios

Load Cordova

In order for Cordova to load correctly, your index.html must explictly refer to the cordova.js script.

  1. Create an index.html and make sure this is copied to your output:

    require('file?name=index.html!./index.html');
  2. Include the cordova.js script in your index.html:

    <script type="text/javascript" src="https://github.com/markmarijnissen/webpack-cordova-plugin/raw/master/cordova.js"></script>

Under the hood

Changelog

0.1.3 (31/10/2014)

0.1.2 (06/08/2014)

0.1.1 (05/08/2014)

0.1.0 (05/08/2014)