-
-
Save IbnSaeed/b7874cfa98325ab3861e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var browserSync = require("browser-sync"); | |
browserSync.use({ | |
plugin: function () { /* noop */}, | |
hooks: { | |
'client:js': require("fs").readFileSync("./reloader.js", "utf-8") // Link to your file | |
} | |
}); | |
browserSync({ | |
server: "./app", | |
files: [ | |
"css/*.css", | |
], | |
open: false | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Reload plugin example | |
*/ | |
(function ($window, $document, bs) { | |
var socket = bs.socket; | |
var canReload = false; | |
socket.on("connection", function (client) { | |
if (canReload) { | |
canReload = false; | |
window.location.reload(); | |
} | |
}); | |
socket.on("disconnect", function (client) { | |
canReload = true; | |
}); | |
})(window, document, ___browserSync___); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment