简体   繁体   中英

Gulpjs webserver access from local network

I've been using gulpjs task runner for the front-end and I always need to watch how my html files look after them change. So, I've configured the webserver plugin of gulp (live-reload is included), but I want to check my pages from other devices (phones, tablets, eg). My answer is:

How can I use gulp webserver from other devices of my local network? Thank you!

gulpjs

Unless I'm missing something here, as long as there's not a firewall running on your machine, you should be able to use the local network IP address of your local machine followed by the port number used by the gulp webserver. For example, if your machine IP is 192.168.0.4 and the gulp server is running on port 4000, you should be able to put http://192.168.0.4:4000/ into the browser of another device on your network and access the page.

Edit: after looking at the documentation for gulp-webserver, I found this in their FAQ (located on the GitHub readme.md https://github.com/schickling/gulp-webserver ):

Why can't I reach the server from the network?

Solution: Set 0.0.0.0 as host option.

https://github.com/schickling/gulp-webserver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM