本地开发时在移动设备中同步浏览器 [英] Browser-sync in mobile while local development
问题描述
如何使用 gulp Browser-sync 在手机中查看本地开发网站?我在手机浏览器中输入 localhost:3000 但它不会加载
How can I view my local dev website in my phone using gulp Browser-sync? I type localhost:3000 in my phones browser but it won't load
推荐答案
当你在终端运行 gulp 时,你应该会看到:
When you run gulp in your terminal you should see :
[BS] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.10.81:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.10.81:3001
这意味着您的本地 URL 是 localhost 的 3000 端口.对于外部用户,它将是外部 IP [不是 UI ].要从您的手机访问,您需要在手机浏览器中输入外部 IP 及其端口.
What it means is that your local URL is localhost at port 3000. For external users it will be the external IP [ not the UI one ]. To access from your phone you need to enter the External IP along with its port in your phone's browser.
您可以通过访问 UI IP 查看所有浏览器同步设置.
You can view all your browser-sync settings by visiting the UI IP.
注意:要在您的手机上使用外部链接,您的手机和计算机应该在同一个 Wi-Fi 网络上,然后才能使用.
这篇关于本地开发时在移动设备中同步浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!