Closed dnsosebee closed 1 year ago
Start a new pull request in StackBlitz Codeflow.
Solved via constructable Stylesheet, like so:
useVisibleTask$(() => {
const sheet = new CSSStyleSheet();
sheet.replaceSync(styles);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
});
Which component is affected?
Qwik Runtime
Describe the bug
I would like a component to apply global styles using a string value at runtime.
Something like this:
export const StyleView = component$((props) => { useStyles$(props.styles); return null; });
However, this throws the error
[vite] Internal server error: Qrl($) scope is not a function, but it's capturing local identifiers: styles Plugin: vite-plugin-qwik
Other suggestions for achieving my goal would also be appreciated.
Reproduction
https://stackblitz.com/edit/qwik-starter-vtrpex?file=src/routes/styleTest/index.tsx
Steps to reproduce
Navigate to the /styleTest route in the StackBlitz.
System Info
Additional Information
No response