v2.25.0
版本发布时间: 2018-10-06 17:52:23
BrowserSync/browser-sync最新发布版本:v3.0.3(2024-09-25 00:17:50)
Browsersync can now be used in more restrictive areas, ones where you cannot simply bind to all addresses on the host (such as schools or universities) - this is enabled via the listen
option.
For backwards compatibility reasons, we actually cannot use the host
option to acheive this (even though that would make the most sense), as it would break some people's existing setups.
This is mainly because in the past, host
was not used to determine an address to bind to, but rather just as a way of changing the urls Browsersync displays to the user. :( :( :(
It was a big mistake, but now with the sheer size of the user base we have, every tiny change to any existing option causes some kind of breakage. I'm not prepared to do that again with host
.
So, instead we're back to the old method of instead adding a new option, that I've called listen
. It's the only way we can acheive the goal without breaking existing users who are using host
for other reasons.
The idea is that you'd only ever use the listen
option if you want to restrict the address being bound to. For example, the following will serve files from the current directory, but behind the scenes Browsersync will only bind to localhost
(this does mean that other features such as external urls
will not work any more, but if you need this listen
option in the first place, that will not be a concern for you)
npm i -g browser-sync@2.25.0
browser-sync . --listen localhost