@viskit/create-style
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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

/@viskit/create-style/

    Package Sidebar

    Install

    npm i @viskit/create-style

    Weekly Downloads

    1

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    12.9 kB

    Total Files

    9

    Last publish

    Collaborators

    • leogiese