Closed shakyShane closed 9 years ago
huh, it's been a while...
right, when overwriting src, the current implementation does not work when livereload.js
is renamed.
since the src string is quite bloated with host, port etc. what do you think of something like this?
var src = opt.src || "//' + (location.hostname || '" + hostname + "') + ':" + port + "/livereload.js?snipver=1";
var file = src.split('/').pop()
...
function snip(body) {
if (!body) return false;
return (~body.lastIndexOf(file));
}
...stom script src's to operate as expected.
Because the
snip
function has the hardcoded value, any attempt to use a customsrc
option results in the snippet being written to the response twice.The test I added simply verifies that the src is only written once.