You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The loader appends `exportconstknightedCss="/* compiled css */"` to the module when imported with `?knighted-css`. Keep your main module import separate to preserve its typing; use the query import only for the CSS string.
187
189
188
190
> [!TIP]
189
191
> The Playwright Rspack demo shows how a Lit host can import specific dialects with `?knighted-css` and pipe them straight into `LitElement.styles`. See [packages/playwright/src/lit-react/lit-host.ts](packages/playwright/src/lit-react/lit-host.ts) for the shadow-root wiring.
190
192
193
+
#### CSS Modules and stable selectors
194
+
195
+
CSS Modules hash class names after the loader extracts selectors, so the stylesheet captured by `?knighted-css` never sees those hashed tokens. Provide a second, stable selector (class or data attribute) alongside the module-generated one so both the DOM and the Lit host share a common hook. A minimal example:
Loader query types ship directly with `@knighted/css`. Reference them once in your project—either by adding `"types": ["@knighted/css/loader-queries"]` to `tsconfig.json` or dropping `/// <reference types="@knighted/css/loader-queries" />` into a global `.d.ts`—and the following ambient modules become available everywhere:
You can plug any Lightning CSS visitor here; we compose it with your `lightningcss.visitor` if provided. Keep the match as narrow as possible to avoid unexpected cascade shifts.
34
+
You can plug any Lightning CSS visitor into `specificityBoost.visitor`; it runs after the built-in `strategy` helpers. Keep the match as narrow as possible to avoid unexpected cascade shifts.
0 commit comments