You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
408 B
19 lines
408 B
function injectCSS(str: string) {
|
|
const style = document.createElement("style");
|
|
style.className = "demon-element-css";
|
|
style.innerHTML = str;
|
|
document.head.appendChild(style);
|
|
}
|
|
|
|
function createClass(name: string, style: object) {
|
|
const stylestr = Object.entries(style)
|
|
.map(([k, v]) => `${k}:${v}`)
|
|
.join(";");
|
|
injectCSS(`.${name} {${stylestr}}`);
|
|
}
|
|
|
|
export default {
|
|
injectCSS,
|
|
createClass
|
|
};
|