Formatter

Tailwind Sorter

High-performance Rust CLI that sorts Tailwind CSS classes into the official recommended order — with cursor position preservation for seamless editor integration.

What it does

Before

<div class="text-white p-4 flex bg-zinc-900 rounded-lg items-center gap-2 hover:bg-zinc-800">

After

<div class="flex items-center gap-2 rounded-lg bg-zinc-900 p-4 text-white hover:bg-zinc-800">

Installation

npm (dev)

npm install --save-dev biome-tailwind-sorter

cargo

cargo install biome-tailwind-sorter

Features

  • Sorts to official Tailwind CSS recommended order
  • Cursor position preservation — no more VS Code cursor jumping
  • HTML, JSX, TSX, and Vue support
  • Respects .gitignore and .ignore files
  • Multi-line class definitions preserved
  • VS Code Run on Save integration
  • Built in Rust — blazing fast

Commands

biome-tailwind-sorter --write src/Sort all files in a directory
biome-tailwind-sorter --check src/Check without writing (CI mode)
biome-tailwind-sorter --write file.tsxSort a single file
biome-tailwind-sorter --write --preserve-cursor --cursor-offset 245 file.tsxSort with cursor preservation (editor integration)