Created
October 4, 2016 01:36
-
-
Save kylefritz/2e33223dfd93d25da4a99a25d8d4e557 to your computer and use it in GitHub Desktop.
check if local webpack server is running; fallback to real s3 asset
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>hello world</title> | |
<script> | |
const makeTag = function(src){ | |
let scriptTag = document.createElement('script') | |
scriptTag.src = src | |
return scriptTag | |
} | |
const developmentTag = makeTag("http://localhost:3000/great-script.js") | |
developmentTag.onerror = function(){ | |
document.head.appendChild(makeTag("http://my-real-asset.js")) | |
} | |
document.head.appendChild(developmentTag) | |
</script> | |
</head> | |
<body> | |
<h1>why hello</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment