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

Organize classes in .php files #234

Closed
Finallf opened this issue Dec 12, 2023 · 2 comments
Closed

Organize classes in .php files #234

Finallf opened this issue Dec 12, 2023 · 2 comments

Comments

@Finallf
Copy link

Finallf commented Dec 12, 2023

What version of prettier-plugin-tailwindcss are you using?
v0.5.9

What version of Tailwind CSS are you using?
v3.3.6

What version of Node.js are you using?
v20.10.0

What package manager are you using?
npm

What operating system are you using?
Windows

Describe your issue

It appears to have been fixed in another plugin:
#shufo/prettier-plugin-blade#161 (comment)
##52

Would there be a way to fix the official one too?

@thecrypticace
Copy link
Contributor

Hey, so we'd almost certainly have the same issues we had before. We stopped supporting PHP because there was no real way for us to pass the partial blocks to Prettier as valid HTML. It would complain or sometimes incorrectly reformat code. And working around this proved to be a pretty sizable task that we didn't want to take on because it would likely mean completely re-implementing the HTML parser — or perhaps the PHP one.

The blade plugin uses the blade-formatter package under the hood which actually implemented Tailwind class sorting itself rather than being able to delegate to any installed Prettier plugins for that. Though, they do appear to use our internal API we introduced in Tailwind CSS for this so the result should be identical between this plugin and their implementation.

So, unfortunately, we're not likely to add PHP support to this plugin unless a prettier plugin for it comes along that gives us the necessary hooks to support this in a way that doesn't break or produce invalid HTML.

@fclaussen
Copy link

For those of you with the same problem, I found this VS Code extension that works with PHP files.
https://marketplace.visualstudio.com/items?itemName=Trapfether.tailwind-raw-reorder

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

3 participants