Created
January 4, 2021 11:28
-
-
Save YonathanMeguira/6e626c7f0d718e46065f455de24d7765 to your computer and use it in GitHub Desktop.
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
const siteHeaderElement = .nativeElement; | |
const customClasses = localStorage.getItem('custom'); | |
.brand-name{color: blue} | |
// regex to get array of classname | |
const classNames = ['NP1', 'NP2', 'LC']; | |
function getElement(className): ElementRef { | |
return siteHeaderElement.find(className); | |
} | |
// array of elements inside the site header that have custom css | |
const elements = classNames.map(c => getElement(c)); | |
// regex | |
elements.forEach(e => e.style=doRegexGetStyle); | |
// second solution | |
const styleTag = document.createElement("style") //localStorage; | |
styleTag.innerHTML = cssTemplateString ; | |
document.head.insertAdjacentElement('beforeend', styleTag); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment