hudochenkov / postcss-styled-syntax

PostCSS syntax for CSS-in-JS like styled-components
MIT License
74 stars 4 forks source link

Auto-fix not working and some issue can not be detected. #20

Closed lashawty closed 1 year ago

lashawty commented 1 year ago

Hi, Thank you for helping me solve the previous issue πŸ‘πŸ»

I've noticed the doc you mentioned about Parsing, my issue may be the problem you talked about:

ζˆͺεœ– 2023-09-18 上午10 50 21

However, if I change my code to this, which will solve the issue, but the project structure is too big to fix the code like this

${media.lg && css`
        margin-top: -30px;
        img {
            width: 50px;
            height: 50px;
        }
    `}

Is there any way I can custom my own syntax for detecting and auto-fixing?

Thanks again for the hard work, really looking forward to adding this feature πŸ₯Ή

hudochenkov commented 1 year ago

Parser only knows about css`` helper. It doesn't know about media.lg`` or any other helper.

css is a common name among many CSS-in-JS libraries. All tools work with it. E.g., Prettier would also look inside css``, but not inside media.lg``.

I'm afraid there won't be any fix in this package, as it's a project specific issue.

lashawty commented 1 year ago

No worries, thanks again for your time.