Home

Awesome

vue-cli-plugin-cordova

Vue CLI 3.x plugin for Apache Cordova.

Integrate Cordova into Vue Cli App

How To

Create Vue App

$ npm install -g @vue/cli
$ vue create my-app
$ cd my-app
$ npm install -g cordova # If cordova is not already installed 

Add the plugin to your vue app.

$ vue add cordova

Usage

Prepare

$ npm run cordova-prepare # prepare for build (you can run this command, when you checkouted your project from GIT, it's like npm install)

Android

$ npm run cordova-serve-android # Development Android
$ npm run cordova-build-android # Build Android
$ npm run cordova-build-only-www-android # Build only files to src-cordova

IOS

$ npm run cordova-serve-ios # Development IOS
$ npm run cordova-build-ios # Build IOS
$ npm run cordova-build-only-www-ios # Build only files to src-cordova

OSX

$ npm run cordova-serve-osx # Development OSX
$ npm run cordova-build-osx # Build OSX
$ npm run cordova-build-only-www-osx # Build only files to src-cordova

Browser

$ npm run cordova-serve-browser # Development Browser
$ npm run cordova-build-browser # Build Browser
$ npm run cordova-build-only-www-browser # Build only files to src-cordova

Electron

$ npm run cordova-serve-electron # Development Electron
$ npm run cordova-build-electron # Build Electron
$ npm run cordova-build-only-www-electron # Build only files to src-cordova

IMPORTANT

What is the plugin doing ?

During installation

During installation, the plugin is setting some important variables, modifying the router mode and executing some cordova commands.

In development mode

In development mode (npm run cordova-serve-*), the plugin is starting the dev server, and creating an app with a webview, showing your dev server page.

It is doing this by:

In Production mode

In production mode (npm run cordova-build-*), the plugin is building the app, with all it's assets and files etc locally in the package. The webview is showing file:///android_asset/www/index.html

It is doing this by:

Please note

License

MIT

Credits

Credits go to

Because my approach for this plugin, was inspired by theirs!