Skip to content

Instantly share code, notes, and snippets.

@Relequestual
Forked from RonnyO/localive.js
Created March 18, 2012 19:00
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 Relequestual/2079848 to your computer and use it in GitHub Desktop.
Save Relequestual/2079848 to your computer and use it in GitHub Desktop.
Conditional loading of live.js for dev environments
// Load live.js on local envs only
// Make sure the path is right and your dev env passes the test.
/* Delete these characters to disable it temporarily -> */
(function() {
if(/^https?:\/\/(localhost|127.0.0.1|(dev|test).*?)\/|^file:\/\/\//.test(document.location.href)) {
var live = document.createElement('script');
live.src = 'js/live.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(live, s);
}
})();
/**/
//Added any domain that starts dev. or test. as is common.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment