Fetches a CSS file and constructs a CSSStyleSheet.
The CSS file location.
The CSSStyleSheet object constructed from the CSS contents.
This is particularly useful for Constructable Stylesheets, which can be shared across Shadow DOM boundaries.
const sheet = await fetchStyle('./component.css')shadowRoot.adoptedStyleSheets = [sheet] Copy
const sheet = await fetchStyle('./component.css')shadowRoot.adoptedStyleSheets = [sheet]
If the fetch fails.
Fetches a CSS file and constructs a CSSStyleSheet.