Use with Lit Element
❗ This example is using Constructable Stylesheet Objects and
DocumentOrShadowRoot.adoptedStyleSheetswhich have limited browser support at the moment (December 2020).
import { LitElement, html } from 'lit-element'
import { create, cssomSheet } from 'twind'
// 1. Create separate CSSStyleSheet
const sheet = cssomSheet({ target: new CSSStyleSheet() })
// 2. Use that to create an own twind instance
const { tw } = create({ sheet })
class TwindElement extends LitElement {
  // 3. Apply the same style to each instance of this component
  static styles = [sheet.target]
  render() {
    // 4. Use "own" tw function
    return html`
      <main class="${tw`h-screen bg-purple-400 flex items-center justify-center`}">
        <h1 class="${tw`font-bold text(center 5xl white sm:gray-800 md:pink-700)`}">
          This is Twind!
        </h1>
      </main>
    `
  }
}
customElements.define('twind-element', TwindElement)
document.body.innerHTML = '<twind-element></twind-element>'