devnax / naxcss

MIT License
1 stars 0 forks source link

breakpoints not working for SSR? #2

Open baptistecs opened 2 months ago

baptistecs commented 2 months ago

Hi,

Thanks a lot for this library, it very lightweight!

It seems that breakpoints styles are not working (at least for SSR):

globalCss(containerClassName, {
    backgroundColor: {
        xs: "red",
        sm: "green",
    },
})

css({
    backgroundColor: {
        xs: "red",
        sm: "green",
    },
})
let styles = ''
NAXCSS_CACHE.forEach(c => {
    styles += c.css
    console.log('HERE', c.css)
})

Gives:

HERE backgroundColor{xs:red;sm:green;}
HERE .css-1cgvbfq{background-color:[object Object];}

Alternatively, I didn't find a way to use media queries, is it possible?

const cls = css({
    width: 200,
    '@media (max-width: 1024px)': {
        '&': {
            width: 150,
        }
    }

Gives

.css-tr2kc0{width:200px;@media (max-width: 1024px):[object Object];}

Thanks in advance!

Best regards, Baptiste