使用cordova s​​erve命令时如何添加实时重载? [英] How to add Live Reload when using the command cordova serve?

查看:105
本文介绍了使用cordova s​​erve命令时如何添加实时重载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下命令在浏览器中打开我的应用程序: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?

我尝试使用phonegap serve代替,它具有实时重载功能,但它会不断向我发送警报并导致浏览器崩溃.

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.

推荐答案

您可以尝试 Cordova Browsersync插件.使用插件的说明在插件的存储库中.

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

使用cordova plugin add cordova-plugin-browsersync添加此插件后,您只需使用cordova run -- --live-reload即可开始实时重新加载.请注意,如果您有多个设备,这还将启用同步滚动和单击.

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.

这篇关于使用cordova s​​erve命令时如何添加实时重载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆