Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transformer-attributify-jsx): ignore the className part #1582

merged 1 commit into from Sep 14, 2022


Copy link

@Flower-F Flower-F commented Sep 12, 2022

When I tried to use the UnoCSS in a React project today, I found a bug of the transformer-attributify-jsx. The transformer-attributify-jsx will change the attribute to xxx="", such as text-red="", to avoid the limitation of React JSX. But it also changes the className part by mistake. For example, I might write some code snippet like this:

<div className={red ? 'text-red' : 'text-green' }></div>

But it would be transformed to something like this:

<div className={red ? 'text-red=""' : 'text-green=""' }></div>

So I can't get the correct result. And this PR is to solve this problem, as it will ignore the className part when transforming jsx.

@Flower-F Flower-F requested a review from antfu as a code owner Sep 12, 2022
Copy link

netlify bot commented Sep 12, 2022

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9259fb5
🔍 Latest deploy log
😎 Deploy Preview
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link

SnowingFox commented Sep 14, 2022


zyyv approved these changes Sep 14, 2022
@antfu antfu merged commit 52cdd7e into unocss:main Sep 14, 2022
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants