solid-styled icon indicating copy to clipboard operation
solid-styled copied to clipboard

Using css tempalte tag in solid-start routes/pages results in an error.

Open jfcieslak opened this issue 1 year ago • 3 comments

Using css tempalte tag in solid-start routes/pages causes an error. Minimum repro example:

import { css } from 'solid-styled'

export default function Page() {
    css`
        .content {
            padding: 2rem;
        }
    `
    return (
        <main>
            <div class="content">This is a plain card</div>
        </main>
    )
}

Error:

Unexpected use of `css`. Make sure that solid-styled's plugin is setup correctly.

Using css template on other components (e.g. ~/components/Component.tsx) works perfectly fine.

Config:

export default defineConfig({
    vite: {
        plugins: [
            solidStyled({
                filter: {
                    include: 'src/**/*.tsx',
                    exclude: 'node_modules/**/*.{ts,js}',
                },
            }) as PluginOption,
        ],
    },
})

jfcieslak avatar Jun 21 '24 12:06 jfcieslak

did you have the correct file extension?

lxsmnsyc avatar Jun 21 '24 13:06 lxsmnsyc

yes, here is a full reproduction. https://github.com/jfcieslak/solid-styled-issue-35-repro

jfcieslak avatar Jun 22 '24 08:06 jfcieslak

Pasting the error for others to find:

Unexpected use of `css`. Make sure that solid-styled's plugin is setup correctly.

jon-zuka avatar Mar 30 '25 23:03 jon-zuka