Inject Stylus into shadowRoots

inject styles of stylus-addon in shadowRoot

Autor
hdyzen
Dnevne instalacije
0
Ukupnih instalacija
0
Ocjene
0 0 0
Verzija
1.1
Stvoreno
29.06.2025.
Ažurirano
25.07.2025.
Size
1,65 KB
Licenza
GPL-3.0-only
Primjenjuje se
Sve stranice

Inject Stylus into shadowRoots

This userscript injects styles from the Stylus extension directly into shadowRoot instances, allowing you to style the content of web components.


How to style content inside a shadowRoot

:host

To apply styles only to the content within a shadowRoot, use the :host pseudo-selector in your Stylus styles. :host refers to the element that contains the shadowRoot (the shadow host).

/* All elements */
* {
  border: 1px violet;
}
/* Only elements inside the shadowRoot */
:host * {
  border: 1px solid mediumpurple;
}

Similar forms: