browser-sync-close-hook
Closes Browser Tabs which are connected to browserSync once browserSync disconnects (when stopping gulp for example).
Install
> npm install browser-sync-close-hook --save-dev
Usage in gulpfile.js
const autoClose = ; gulp;
Source
The only thing this module does is exporting a function string which useses the clients browsers window.close function to close the tab.
moduleexports = "___browserSync___.socket.on('disconnect', window.close.bind(window));";
Credits
for providing the original solutions:
for the discussion which let to solving the issue of too many open tabs: