jj
    Preparing search index...

    Function cssToStyle

    • Converts a CSS string to a CSSStyleSheet.

      Parameters

      • css: string

        The CSS string.

      Returns Promise<CSSStyleSheet>

      A promise resolving to the created CSSStyleSheet.

      Suitable for attaching to ShadowRoot via adoptedStyleSheets.

      const sheet = await cssToStyle('p { color: red; }')
      shadowRoot.adoptedStyleSheets = [sheet]