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

Is it possible to use prettier-plugin-tailwindcss with tailwind-rn? #193

Open
darrylyoung opened this issue Jan 16, 2023 · 2 comments
Open

Comments

@darrylyoung
Copy link

Hi, everyone!

This is my first time using tailwind-rn, and I wondered if it's possible to use something like prettier-plugin-tailwindcss to automatically sort and clean up classes? I tried it with a React Native project and it didn't work, but I was wondering if there were any config settings you'd recommend, or if there were alternatives.

For context, I ask because I've been helping out with a project that uses tailwind-rn and I'd love to have a quick way to clean up things like this. By clean up, I mean sort out the spacing, organise the classes, etc.

style={tailwind(
    'rounded-8  border-gray-400 border-dashed  items-center border-1 px-40  ',
)}
@visormatt
Copy link

@darrylyoung I opened a PR on the prettier-plugin-tailwind side of things for exactly this. No plans on supporting the "style" property or react native officially as of now 🤷 You can however patch that package to also look in style attributes for prettier to update. In the packages build file you'd search for "class","className" and update it to "class","className","style" and then patch it npx patch-package prettier-plugin-tailwindcss

@darrylyoung
Copy link
Author

@visormatt Thanks, Matt! Much appreciated. I'll keep an eye on things over on the Tailwind side, but your solution looks good for now.

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

No branches or pull requests

2 participants