BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.18k stars 756 forks source link

Ability to disable sync functionality #763

Closed mikehaas763 closed 9 years ago

mikehaas763 commented 9 years ago

Essentially what I would like to do is have the ability through configuration to disable all the sync functionality so that Browsersync becomes just a web server. The way I can do this now is to use the scriptPath option to return a path that does not exist. However, that still results in a request it just ends up being a 404. It would be nice if there was a better way. Does this functionality already exist and I just missed it?

I use the Protractor E2E testing framework and that's why I want this feature. A regularly started up Browsersync server causes Protractor to timeout. With educated guessing, I believe this is because Protractor sees the socket connection open and believes that the page is not yet ready to be tested. I could be wrong about that. What I do know is that using a false scriptPath results in Protractor working. So essentially when Browsersync's script is not loaded.

shakyShane commented 9 years ago

http://www.browsersync.io/docs/options/#option-ghostMode

ghostMode: false
shakyShane commented 9 years ago

Oh, just read that again, are you saying it's just the loading of the script file you want to cancel

shakyShane commented 9 years ago

If yes, then you want snippetOptions.blacklist

snippetOptions: {
    blacklist: ["/", "**/*"]
}
mikehaas763 commented 9 years ago

@shakyShane Yes. I'll give that a try.

shakyShane commented 9 years ago

Ok, then my comment above will work as you need :)

mikehaas763 commented 9 years ago

Does the client script serve any purpose if the socket connection was disabled? I'm wondering if the ability to just disable the socket connection is a less drastic option.

Otherwise, yes that prevented the script from loading. Thank you.