Last active
July 6, 2017 13:11
-
-
Save marco-kretz/75b49f274eb1d66c7a60e9ba6c3eadb8 to your computer and use it in GitHub Desktop.
Import CSS file dynamically via JavaScript
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
function requireCSS(url) { | |
var cssLink = document.createElement("link"); | |
cssLink.href = url; | |
cssLink.type = "text/css"; | |
cssLink.rel = "stylesheet"; | |
document.getElementsByTagName("head")[0].appendChild(cssLink); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment