prettier-plugin-blade: Cannot seem to get sortTailwindcssClasses working in VSCode
I cannot seem to get the Tailwindcss auto sorting working in VSCode. On save it does seem to use the prettier-plugin-blade package.
I’m testing this by juggling some Tailwind classes in my blade template into a random order. What am I doing wrong?
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 150,
"useTabs": true,
"tabWidth": 1,
"plugins": ["@shufo/prettier-plugin-blade"],
"overrides": [
{
"files": ["*.blade.php"],
"options": {
"parser": "blade",
"printWidth": 999,
"sortTailwindcssClasses": true,
"wrapAttributes": "auto",
"sortHtmlAttributes": "none",
"noPhpSyntaxCheck": false
}
}
]
}
Saving a .blade.php file
["INFO" - 3:47:23 PM] Prettier Options:
{
"filepath": "/mypath/resources/views/vp-account-settings.blade.php",
"parser": "blade",
"useTabs": true,
"tabWidth": 1,
"endOfLine": "lf",
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 999,
"plugins": [
"/mypath/node_modules/@shufo/prettier-plugin-blade/dist/index.js"
],
"sortTailwindcssClasses": true,
"wrapAttributes": "auto",
"sortHtmlAttributes": "none",
"noPhpSyntaxCheck": false
}
["INFO" - 3:47:23 PM] Formatting completed in 139ms.```
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 24 (5 by maintainers)
Recently I fixed a Tailwind related bug that reproduced when I upgraded Tailwind to 3.2 and Released https://github.com/shufo/prettier-plugin-blade/releases/tag/v1.8.6.
Can anyone try 1.8.6? After upgrading, don’t forget to reload the Editor (VSCode, PHPStorm, etc…)
It seems to be fixed in every editor, so I’m going to close this issue.
Yep, since 1.8.6 everything works fine in PHPStorm.
You’re awesome @shufo !
@shufo version 1.8.6 fixed my issues in VS Code! THANK YOU!!!
@shufo In some limited tests I am seeing that it is now working in Panic’s Nova editor ( for Mac ) 🎉
@shufo I am using VSCode where it is not working. I tried the exact same classes that you did and they don’t sort for me. I will try and play around with it some more to see if I can narrow it down.
@shufo Fresh install laravel with only blade-prettier plugin. Everything works, even sorting my classes with tailwind classes, but not tailwind classes order (tried version 1.7 and 1.8 of blade-prettier):
Previously flex and flex-col always stand together
Thanks for creating the issue. I’ll look into it.