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 stars179 forks50 contributorsActive · 1mo agoSince 2021v0.8.1MIT

Meet the team

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

Languages

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

Commit activity

Last 12 weeks · 2 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 · 6 in progress · Last activity 1mo ago
See all on GitHub →
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 · 2w ago
snoozbuster
Linting markdown fenced code blocks uses embedded tailwind libraryOpenIssue

What version of are you using? 0.8.1 What version of Tailwind CSS are you using? 4.3.3 What version of Node.js are you using? 24.1.1 What package manager are you using? npm What operating system are you using? macOS Reproduction URL https://github.com/snoozbuster/tailwind-prettier-plugin-repro To reproduce: Claude has provided some hypotheses about the root cause in the . I have no idea how accurate it is. Describe your issue* Formatting a Markdown file that contains a / fenced code block which uses the syntax introduced in tailwind 4.3 makes print css modifier(number,--default(100)-) ^^ default(...)--modifier(...).tsxtailwindcss@4.3.3`. This occurs even when tailwindcss 4.3.3 is present in the repository as a dependency. This is probably related to #468, but it's not clear to me if that is a separate issue or not. In my case I don't particularly care if the plugin works inside markdown files, I just don't want it to warn on them like this.

snoozbuster · 3w 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 · 3w ago

Recent fixes

View closed PRs →
reinink
Incompatibility with other Prettier pluginsClosedIssue

To make this plugin work we had to use private Prettier APIs that can only be used by a single plugin at once. This means this plugin is incompatible with other Prettier plugins that are using the same APIs. This GitHub issue will serve as a place to keep track of which Prettier plugins are incompatible — and hopefully we'll eventually find some workarounds, or even a proper long term solution. 👍 Known incompatibilities (see below)* prettier-plugin-svelte We've bundled the directly into , so if you'd like to use this plugin with Svelte, just uninstall and everything should work as expected. Workarounds While I have not tested it yet, @Mattinton provided one possible workaround in this comment.

reinink · 1w ago
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 · 2w 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: 7130, Forks: 179. Primary language: TypeScript. Languages: TypeScript (97.6%), JavaScript (2.4%). License: MIT. Latest release: v0.8.1 (1mo ago). Open PRs: 6, open issues: 10. Last activity: 1mo 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