Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function livereload(options) {
var lr = require("tiny-lr");
var server = lr();
var port = options || 35729;
server.listen(port, function(err) {
console.log("livereload server started");
});
function bundleVisitor(cb) {
return function getBundleNames(bundle) {
if (bundle) {
cb(bundle);
}
return bundle;
};
}
return {
postbundle: function(bundler, context) {
var bundleDest = [];
context.visitBundles(bundleVisitor(function(bundle) {
bundleDest.push(bundle.dest);
}));
if (bundleDest.length) {
server.changed({
body: {
files: bundleDest
}
});
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.