GitShow/tailwindlabs/prettier-plugin-tailwindcss
tailwindlabs

prettier-plugin-tailwindcss

A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order.

by tailwindlabs
Star on GitHubForknpm

TypeScript

7.1k stars176 forks50 contributorsActive · 2w agoSince 2021v0.8.0MIT

Meet the team

See all 50 on GitHub →
thecrypticace
thecrypticace196 contributions
bradlc
bradlc82 contributions
Dunqing
Dunqing16 contributions
reinink
reinink16 contributions
RobinMalfait
RobinMalfait11 contributions
adamwathan
adamwathan9 contributions
Boshen
Boshen5 contributions
akx
akx3 contributions

Languages

View on GitHub →
TypeScript97.6%
JavaScript2.4%

Commit activity

Last 12 weeks · 10 commits

Full graph →

Community health

2 of 6 standards met

Community profile →
50
✓README✓License○Contributing○Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 3 in progress · Last activity 2w ago
See all on GitHub →
alexschcom
Doesn't work with AstroOpenIssue

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

alexschcom · 3w ago
ramong26
Fix compatible plugin chaining when prettier-vscode passes plugin.name as an absolute path on Windows.OpenPR

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 ()

ramong26 · 1mo ago
llanesluis
Plugin chaining (sort-imports) silently fails on Windows when loaded via prettier-vscodeOpenIssue

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.

llanesluis · 1mo ago

Recent fixes

View closed PRs →
mrsylvestre
Won't sort classes in .svelte filesClosedIssue

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 )

mrsylvestre · 3d ago
firatciftci
Fix Svelte class sorting with prettier-plugin-svelte v4MergedPR

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.

firatciftci · 2w ago
mr-chetan
prettier-plugin-tailwindcss@0.8.0 give error on npm installClosedIssue

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

mr-chetan · 3w ago
Structured data for AI agents

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.

·@ofershap

Replace github.com with gitshow.dev