Skip to content

Instantly share code, notes, and snippets.

@ignlg
Forked from timthez/closer.js
Last active August 26, 2015 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ignlg/b9dead5bcadc8cfa454e to your computer and use it in GitHub Desktop.
Save ignlg/b9dead5bcadc8cfa454e to your computer and use it in GitHub Desktop.
Close tab on browserSync disconnection, Gulp example
browserSync = require 'browser-sync'
browserSync.use
plugin: ->
hooks:
'client:js': '
/* Close tab when server dies */
(function (bs) {
bs.socket.on("disconnect", function (client) { window.close(); });
})(___browserSync___);'
# Static server
gulp.task 'browser-sync', ->
browserSync.init
server: "./dist/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment