Skip to content

Instantly share code, notes, and snippets.

@Ollo
Created January 3, 2014 20:00
Show Gist options
  • Save Ollo/8245471 to your computer and use it in GitHub Desktop.
Save Ollo/8245471 to your computer and use it in GitHub Desktop.
hacky localhost check for livereload injection
// check if running locally for livereload
var url = window.location.protocol + "//" + window.location.host + window.location.pathname;
// grab the reload script from grunt
if ( url == "http://portal.dev" ) {
var lr = document.createElement("script");
lr.type = "text/javascript";
lr.src="//localhost:35729/livereload.js";
$('#global_footer').append(lr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment