Prettier plugin that automatically sorts utility classes in Tailwind CSS projects using the official class ordering from Tailwind. Current stable version is 0.7.3 (November 2024), with frequent releases addressing compatibility with the latest Prettier and Tailwind versions. It works with Tailwind v3 and v4, supports TypeScript configs, and integrates with many other Prettier plugins like prettier-plugin-svelte, prettier-plugin-astro, and @ianvs/prettier-plugin-sort-imports. Key differentiator: it is developed by the Tailwind CSS team, ensuring the sort order matches the official Tailwind CSS IntelliSense extension. Requires Node.js >=20.19 and Prettier ^3.0.
npm install prettier-plugin-tailwindcssVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin in .prettierrc and the sorting behavior on a Tailwind class attribute.
Update Prettier to >=3.0. Prettier v2 users should stay on v0.5.x.
Upgrade Node.js to >=20.19 or pin to v0.6.x.
Replace 'tailwindEntryPoint' with 'tailwindStylesheet' in your Prettier config.
Update to v0.7.2 or later.
npm install -D prettier-plugin-tailwindcss and add '"plugins": ["prettier-plugin-tailwindcss"]' to .prettierrc.
Ensure Tailwind CSS is installed and the stylesheet path is correct. Verify compatibility with Tailwind v4 (v0.6.11+ recommended).
Update Prettier to v3: npm install -D prettier@^3.0.0