Created
November 1, 2018 20:33
-
-
Save ThatGuySam/ee70208c158e1a09171642b7949734f2 to your computer and use it in GitHub Desktop.
Switches between dev and production resources - Designed to work with Laravel Mix + Valet + Zeit's Now
This file contains hidden or 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
var sectionId = ''; | |
var isDev; | |
var assetDomain = 'https://production.now.sh'; | |
if(window.localStorage) { | |
isDev = localStorage.getItem("isDev"); | |
} | |
if (isDev) { | |
console.log('Using local assets'); | |
assetDomain = 'https://development.test'; | |
} | |
var externalScript = document.createElement('script'); | |
externalScript.setAttribute('src', assetDomain + '/public/js/app.js'); | |
document.head.appendChild(externalScript); | |
var externalStyle = document.createElement("link"); | |
externalStyle.setAttribute("rel", "stylesheet"); | |
externalStyle.setAttribute("type", "text/css"); | |
externalStyle.setAttribute("href", assetDomain + '/public/css/app.css'); | |
document.head.appendChild(externalStyle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment