create-style
create style tag ,and create css module.
API
createStyleTag(cssString):void;
create css style tag.
createStyleTag(cssString,true): cssModuleName;
E.g lit-element writing
const wrapClassName = createStyleTag(
`
.container {
color: green;
}
`,
true
);
class Comp extends LitElement {
createRenderRoot() {
return this;
}
firstUpdate() {
this.classList.add(wrapClassName);
}
}
window.customElements.define("viskit-comp", Comp);
<viskit-comp>
<div class="container"></div>
</viskit-comp>
createStyleTag(cssString,cssModuleName): cssModuleName;
E.g lit-element writing
const wrapClassName = "wrap-"+Date.now();
createStyleTag(
`
.container {
color: green;
}
`,
wrapClassName
);
class Comp extends LitElement {
createRenderRoot() {
return this;
}
firstUpdate() {
this.classList.add(wrapClassName);
}
}
window.customElements.define("viskit-comp", Comp);
<viskit-comp>
<div class="container"></div>
</viskit-comp>
LICENSE
MIT