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

Escaping slashes are stripped #284

Closed
hugovandevliert opened this issue Jun 5, 2024 · 2 comments · Fixed by #286
Closed

Escaping slashes are stripped #284

hugovandevliert opened this issue Jun 5, 2024 · 2 comments · Fixed by #286
Assignees

Comments

@hugovandevliert
Copy link

hugovandevliert commented Jun 5, 2024

What version of prettier-plugin-tailwindcss are you using?

0.5.3

What version of Tailwind CSS are you using?

3.1.7

What version of Node.js are you using?

18.7.0

What package manager are you using?

npm

What operating system are you using?

macOS

Reproduction URL

https://github.com/hugovandevliert/prettier-plugin-tailwindcss-escaping-slashes

Steps:

  1. npm i
  2. npx prettier --write foo.tsx
  3. git diff

Note: this reproduction repo uses different versions as those listed above.

Describe your issue

Escaping slashes in tailwind classes are stripped when used in combination with classNames.

Original code:

export default () => (
  <span
    className={classNames('md:p-2 m-1 m-3 p-4', "before:content-['\\ea53']")}
  />
);

After running npx prettier --write file_name.tsx:

export default () => (
  <span
    className={classNames('m-1 m-3 p-4 md:p-2', "before:content-['ea53']")}
  />
);

Note the missing \\.

@thecrypticace
Copy link
Contributor

I've merged a fix for this and will try to get a patch out later today 👍

@hugovandevliert
Copy link
Author

That's impressively quick. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants