Last active
May 9, 2018 01:04
-
-
Save hugoabernier/0e612b61f1fc5dd0e45c74a257383fde to your computer and use it in GitHub Desktop.
Inject CSS
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
@override | |
public onInit(): Promise<void> { | |
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`); | |
const cssUrl: string = this.properties.cssurl; | |
if (cssUrl) { | |
// inject the style sheet | |
const head: any = document.getElementsByTagName("head")[0] || document.documentElement; | |
let customStyle: HTMLLinkElement = document.createElement("link"); | |
customStyle.href = cssUrl; | |
customStyle.rel = "stylesheet"; | |
customStyle.type = "text/css"; | |
head.insertAdjacentElement("beforeEnd", customStyle); | |
} | |
return Promise.resolve(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment