A Prettier plugin that automatically sorts Tailwind CSS utility classes in a consistent order and removes duplicates, version 1.5.0 (last release Feb 2021). It works with HTML, JS, JSX, TS, TSX, Vue, and since v1.5.0 also CSS/SCSS/LESS. The plugin is stable but no longer actively maintained (no releases since 2021). Compared to alternatives like `prettier-plugin-tailwindcss` (official), this plugin is older, less popular, and has fewer features (no Tailwind v3+ support confirmed). It offers configurable class sorting and deduplication via options `removeDuplicatesClasses`, `classRegex`, and `classSorter`.
npm install prettier-plugin-tailwind-cssVerified import paths — ran on the pinned version, not inferred.
Demonstrates installation, configuration, and output of sorting Tailwind classes with the plugin.
Migrate to 'prettier-plugin-tailwindcss' or '@trivago/prettier-plugin-tailwindcss' and adjust configuration.
If using Tailwind v3+, prefer the official plugin 'prettier-plugin-tailwindcss' which supports Tailwind v3+.
Set 'removeDuplicatesClasses': false to preserve duplicates.
Create separate JSON files and reference them correctly.
npm install --save-dev prettier-plugin-tailwind-css and add "plugins": ["prettier-plugin-tailwind-css"] to .prettierrc
Create a minimal 'tailwind.config.js' (even empty) in your project root, or ensure Tailwind is installed.
Add "overrides": [{ "files": "*.vue", "options": { "parser": "vue" } }] to .prettierrc