Skip to content

extractCss() returns empty string in Solid SSR environment #495

Open
@viridia

Description

Here's an example demonstrating the problem:

https://stackblitz.com/edit/solid-start-bare-ts-g7hiuv?file=src/routes/index.tsx

I'm only using css() for this demo, not styled().

I am generating the <style> element using the following code:

<style id="_goober" innerHTML={extractCss()}>{' '}</style>

If you examine the HTML response in the network tab, you'll see that the <style> element for goober is empty, even though I am using extractCss() to generate the content.

The styles look correct once goober has had a chance to render them on the client side, but there is a flash of unstyled content.

I also tried this with another CSS framework - Stitches - and did not encounter this same problem - that is, the following code works as expected:

<style id="stitches" innerHTML={getCssText()}>{' '}</style>

...where getCssText() is the Stitches equivalent of extractCss().

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions