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

<a p-3/> transform failed with attributify mode in nuxt3 tsx. #1876

Closed
chaozwn opened this issue Nov 14, 2022 · 11 comments · Fixed by #1879
Closed

<a p-3/> transform failed with attributify mode in nuxt3 tsx. #1876

chaozwn opened this issue Nov 14, 2022 · 11 comments · Fixed by #1879
Labels
bug Something isn't working

Comments

@chaozwn
Copy link

chaozwn commented Nov 14, 2022

code below.
image
code transform:
image

correctly code:
image

@zyyv
Copy link
Member

zyyv commented Nov 14, 2022

Have you try to use transformer-attributify-jsx?

@chaozwn
Copy link
Author

chaozwn commented Nov 14, 2022

yes, and i found why p-3 invalid. i remove key={index}. it works well.

@chaozwn
Copy link
Author

chaozwn commented Nov 14, 2022

image

@chaozwn
Copy link
Author

chaozwn commented Nov 14, 2022

image

@chaozwn
Copy link
Author

chaozwn commented Nov 14, 2022

Have you try to use transformer-attributify-jsx?

i use it.

@zyyv
Copy link
Member

zyyv commented Nov 15, 2022

Hi, i test it in my local, transform it correctly.

test('testSomething', async () => {
  const testCode = `
    <a href="#" p-3 key={index}>友情链接</a>
  `
  const code = new MagicString(testCode)

  await transformerAttributifyJsx().transform(code, 'app.jsx', { uno, tokens: new Set() } as any)

  expect(code.toString()).toMatchInlineSnapshot(`
    "
          <a href=\\"#\\" p-3=\\"\\" key={index}>友情链接</a>
        "
  `)
})

@chaozwn
Copy link
Author

chaozwn commented Nov 15, 2022

Hi, i test it in my local, transform it correctly.

test('testSomething', async () => {
  const testCode = `
    <a href="#" p-3 key={index}>友情链接</a>
  `
  const code = new MagicString(testCode)

  await transformerAttributifyJsx().transform(code, 'app.jsx', { uno, tokens: new Set() } as any)

  expect(code.toString()).toMatchInlineSnapshot(`
    "
          <a href=\\"#\\" p-3=\\"\\" key={index}>友情链接</a>
        "
  `)
})

please check your version. transformer-attributify-jsx.test.ts line:82 is if (curlybraceRE.test(attributifyPart)) right?

@zyyv
Copy link
Member

zyyv commented Nov 15, 2022

Oh, sorry, i forget to pull the latest code. Yes, there is something wrong.

Thanks for taking the time to catch this error.

@zyyv zyyv added the bug Something isn't working label Nov 15, 2022
@chaozwn
Copy link
Author

chaozwn commented Nov 15, 2022

Oh, sorry, i forget to pull the latest code. Yes, there is something wrong.

thanks. can a new version be released soon?

@chaozwn
Copy link
Author

chaozwn commented Nov 15, 2022

If you haven't fixed it yet, I can try it.

@sudongyuer
Copy link
Member

If you haven't fixed it yet, I can try it.

Sure , pr welcome ~

@zyyv zyyv linked a pull request Nov 15, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants