A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order.
by tailwindlabsTypeScript
Last 12 weeks · 10 commits
2 of 6 standards met
What version of are you using? v0.7.2 What version of Tailwind CSS are you using? v4.2.0 What version of Node.js are you using? v22.20.0 What package manager are you using? npm What operating system are you using? macOS Reproduction URL https://github.com/alexschcom/prettier-plugin-tailwindcss-issue Describe your issue** → `` class list should change to
What Resolved a plugin chaining compatibility issue between: The issue started occurring on . Problem In a Windows + pnpm + prettier-vscode environment, the following symptoms were observed: Depending on plugin order, only one feature worked: import sorting Tailwind class sorting VSCode format-on-save and CLI formatting produced different results worked correctly, while introduced the issue Related issues: tailwindlabs/prettier-plugin-tailwindcss#455 Root Cause internally checks enabled plugins using plugin names. However, in prettier-vscode on Windows, plugin names are resolved as native file paths: while compatibility checks expect slash-based package names: Because Windows paths use backslashes (), plugin chaining silently failed. Fix Normalized plugin names before passing them into the parser chain. Result Both features now work correctly together: import sorting Tailwind class sorting Verified in: Windows 11 pnpm workspace prettier-vscode CLI ()
What version of are you using? v0.7.3 (regression — v0.7.2 works correctly on the same setup, also reproduced on ) What version of Tailwind CSS are you using? v4.x What version of Node.js are you using? v24.11.0 What package manager are you using? pnpm v10.28.2 What operating system are you using? Windows 11 Reproduction URL https://github.com/llanesluis/plugin-chaining-fails-silently NOTE: The repo includes a file for guidance. Describe your issue When is combined with and Prettier is invoked through the VS Code extension on Windows (format on save), the sort-imports chain silently fails — imports are never reordered on save. Tailwind class sorting and base Prettier formatting still work on the same save. Running Prettier from the CLI () on the same project and config works correctly: imports are reordered and grouped as expected, Tailwind class sorting and base Prettier formatting work too. This is a regression from v0.7.2 → v0.7.3. Pinning makes the problem disappear entirely; upgrading to reintroduces it. Identified potential root cause In dist/index.mjs, findEnabledPlugin does: Prettier CLI sets plugin.name to the package name → plugin === name matches → chain succeeds. prettier-vscode resolves package names to file paths before Prettier loads them, so plugin.name ends up as the native Windows path, e.g.: On Windows the package segment is (backslash), but name is "" (forward slash). → plugin.includes(name) returns false → chain drops silently. Verified local patch Applied via pnpm patch against prettier-plugin-tailwindcss@0.7.3 — after this patch, VS Code save and CLI both correctly chain the sort-imports plugin: Tested on Windows 11 with both npm and pnpm across plain Next.js (minimal reproduction uses Next.js app) and a pnpm monorepo — both CLI and prettier-vscode save work after the patch, on paths with and without spaces.
What version of are you using? 0.8.0 What version of Tailwind CSS are you using? ^4.3.0 What version of Node.js are you using? 24.13.1 What package manager are you using? pnpm What operating system are you using? Linux (Ubuntu 24 LTS) Reproduction URL Tried making a StackBlitz but it would never sort any files (.svelte, .html, .ts)... If you want to repro, reach out to me I can jump on a call and showcase as needed. https://stackblitz.com/edit/sveltejs-kit-template-default-tvdhiybv?file=src%2Froutes%2F%2Bpage.svelte Describe your issue** I cannot get tailwind classes to get sorted in .svelte files, but it will work fine with .html or even .ts files (using )
Fixes Svelte class sorting with . The recently released version 4 of now parses with the modern Svelte AST. That changed the template shape from the legacy / structure to / , so the Svelte transformer was no longer reaching markup class attributes or dynamic expressions. This PR updates the Svelte traversal to handle both AST shapes, while preserving the existing legacy path. It also updates the Svelte plugin test dependency to v4 so this regression is covered.
What version of are you using? For example: v0.8.0 What version of Tailwind CSS are you using? For example: v4.3.0 What version of Node.js are you using? For example: v26.0.0 What package manager are you using? npm What operating system are you using? macOS Reproduction URL Following is my package.json file that give me issue https://gist.github.com/mr-chetan/c307b48f2a9d29470a7312a02cfed8f0 Describe your issue** give error on
Repository: tailwindlabs/prettier-plugin-tailwindcss. Description: A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order. Stars: 7097, Forks: 176. Primary language: TypeScript. Languages: TypeScript (97.6%), JavaScript (2.4%). License: MIT. Latest release: v0.8.0 (2mo ago). Open PRs: 3, open issues: 6. Last activity: 2w ago. Community health: 50%. Top contributors: thecrypticace, bradlc, Dunqing, reinink, RobinMalfait, adamwathan, Boshen, akx, AngusMorton, AlexanderOpran and others.