CSSStyleSheet

CSSStyleSheet re-exports the global CSSStyleSheet constructor, so you can construct sheets directly without reaching for window. For a cached, string-keyed factory use sheet instead.

Examples

Construct a sheet directly

Builds a sheet by hand and adopts it. Use this when you need a fresh, uncached instance; reach for sheet when you want caching by CSS string.

import { CSSStyleSheet, addAdoptedStyleSheet } from 'pota/use/css'

const s = new CSSStyleSheet()
s.replaceSync('body { background: black }')

addAdoptedStyleSheet(document, s)