Giter Club home page Giter Club logo

cordova-plugin-gapreload's Introduction

cordova-plugin-gapreload

LiveReload plugin for Cordova/PhoneGap applications. Watch the video demo (installation procedure a bit outdated, see below instead).

Installation

Note: if you use the grunt-gapreload task, skip these steps and follow the proper documentation instead.

  1. Install the LiveReload app (latest version can be found here).
  2. Install the Apache Cordova 3 CLI: $ npm install -g cordova (you may need to use sudo).
  3. cd into your Cordova app folder previously created using the cordova create command.
  4. Install GapReload: $ cordova plugin add pro.fing.cordova.gapreload --variable SERVER_HOST="<host>" where <host> typically is your localhost IP address (static is better). Note that passing the SERVER_HOST is now optional since the plugin will also prompt you to set it at runtime.
  5. Follow GapReload instructions in your terminal window and you will be good to go.

Configuration

The SERVER_HOST variable is somehow mandatory. Other available variables are:

Variable name Default value
SERVER_PORT 8000
LIVERELOAD_HOST SERVER_HOST
LIVERELOAD_PORT 35729

Generally you should not modify those values but, if you really have to, just know that you can.

Setting values for SERVER_HOST and LIVRELOAD_HOST using the CLI will also automagically whitelist them for you.

But you can also declare/override values in plugins/pro.fing.cordova.gapreload/gapreload.xml like so:

<?xml version="1.0" encoding="UTF-8"?>
<gapreload>
  <param name="SERVER_HOST" value="whatever you want"/>
  <param name="SERVER_PORT" value="whatever you want"/>
  <param name="LIVERELOAD_HOST" value="whatever you want"/>
  <param name="LIVERELOAD_PORT" value="whatever you want"/>
</gapreload>

Removal

Note: if you use the grunt-gapreload task, skip these steps and follow the proper documentation instead.

Because you shouldn't let this plugin make it to production.

  1. cd into your Cordova app folder.
  2. Execute $ cordova plugin remove pro.fing.cordova.gapreload.
  3. That's it, GapReload is gone for good.

Notes

  • As GapReload will redirect your whole app to http://$SERVER_HOST:$SERVER_PORT/, cross-origin requests won't work anymore without a proper configuration.

TODO

  • Test on platforms other than iOS and Android and make it work if needed.

Weird stuff to investigate

  • I noticed that when using Chrome 32.0.1700.107 and LiveReload 2.3.34, once every two page refresh, the livereload.js file doesn't load at all. An error is thrown and this is what I get for this particular request in the developer tools: caution provisional headers are shown...

cordova-plugin-gapreload's People

Contributors

dlmiles avatar retailos avatar sebastien-p avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.