Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Live Reload when using the command cordova serve?

I am using this command to open up my app in the browser: cordova serve but it does not refresh itself when I update my code. How can I do that?

I have tried to use phonegap serve instead which has a live reload but it keeps sending me alerts and crashes my browser.

So, if you can please tell me how can I solve either of the two issues that will be wonderful.

like image 362
Matan Gubkin Avatar asked Mar 06 '15 22:03

Matan Gubkin


People also ask

Which command is used to install plugin in Cordova?

Install the cordova module using npm utility of Node. js. The cordova module will automatically be downloaded by the npm utility. On OS X and Linux, prefixing the npm command with sudo may be necessary to install this development utility in otherwise restricted directories such as /usr/local/share .


1 Answers

You could try the Cordova Browsersync plugin. Instructions to use the plugin are in the plugin's repo.

Once you add this plugin using cordova plugin add cordova-plugin-browsersync, you can simply use cordova run -- --live-reload to start live reload. Note that this also enables syncing scrolls and clicks if you have multiple devices.

like image 114
axemclion Avatar answered Sep 23 '22 05:09

axemclion