The whole class handling layer of our app is five lines:
import { type ClassValue , clsx } from " clsx " import { twMerge } from " tailwind-merge "
export function cn (... inputs : ClassValue []) { return twMerge ( clsx ( inputs )) }
Enter fullscreen mode
Exit fullscreen mode
That is lib/utils.ts , the file every shadcn/ui install drops in, used at 54 call sites across 18 files here. Two dependencies, one function, zero configuration. I wanted to know what it actually produces in production, so I fetched all 72 URLs from pub-trivia.app/sitemap.xml and counted.
What 72 pages of Tailwind weigh
HTML, all 72 pages 5,081,245 bytes class attributes 13,379 bytes inside them 674,045 (13.3% of the HTML) distinct class strings 324
Enter fullscreen mode
Exit fullscreen mode
Thirteen per cent of every byte we serve is the contents of class . That number sounds like an indictment and is not, because of the third line: 13,379 attributes are built from 324 unique strings.…