# UseClassy Readable utility CSS. No horizontal scroll. A Vite plugin (`vite-plugin-useclassy`) that turns variant attributes (`class:hover`, `className:focus`, `class:sm:hover`) into normal Tailwind CSS and UnoCSS classes. No runtime. Place it before your CSS engine. Use it when writing or refactoring Vue, React, Svelte, Blade, or HTML that uses Tailwind/UnoCSS hover, focus, responsive, dark, or group variants. - Website: https://useclassy.com/ - Docs: https://useclassy.com/docs.md - Agent skill: https://useclassy.com/skill.md - GitHub: https://github.com/jrmybtlr/useclassy ## Quick start ```bash npm i -D vite-plugin-useclassy npx vite-plugin-useclassy init ``` `init` patches Vite and your CSS engine, and installs agent skills by default so coding agents keep writing `class:hover` instead of `hover:` prefixes. Pass `--no-skills` to skip agent files. See the [docs](https://useclassy.com/docs.md) for Usage, Vite, Tailwind, UnoCSS, IntelliSense, and the agent skill. --- # 🎩 UseClassy A Vite plugin that automatically rewrites conditional class attributes like `class:hover` or `class:focus` into standard utility classes usable by Tailwind CSS and UnoCSS. UseClassy lets you write cleaner, more maintainable variant styles in your HTML, Vue, React, Blade, and Svelte code, with no runtime overhead. ```html ``` becomes `class="@container rounded px-4 bg-blue-600 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-300 @md:px-6"`. There is no runtime. Put UseClassy before Tailwind or UnoCSS so those engines see the rewritten utilities. ## Install ```bash npm i -D vite-plugin-useclassy npx vite-plugin-useclassy init ``` `init` patches Vite and your CSS engine, plus VS Code IntelliSense for Tailwind. Run it from the app root (the folder with `package.json` and `vite.config.*`). | Option | Default | Notes | | ---------------- | ------------ | ---------------------------------------------------------------------------------- | | `--language` | `'vue'` | `'vue'` \| `'react'` \| `'blade'` \| `'svelte'` | | `--engine` | auto-detect | `'tailwind'` \| `'unocss'`; Tailwind wins if both are installed | | `--with-skills` | `true` | Agent skill, Cursor rules, and `AGENTS.md` (default on) | | `--no-skills` | — | Skip agent skill / Cursor rules / `AGENTS.md` | | `--with-claude` | `false` | Also copy to `.claude/skills/` (incompatible with `--no-skills`) | | `--force` | `false` | Overwrite locally edited skill files | | `--dry-run` | `false` | Print planned edits | If detection fails, follow the [manual setup](#vite) below. ## Usage **Vue / HTML.** Use `class` plus `class:modifier`: ```vue // After: move safely separable static variants; keep unrelated base expressions. ``` React also supports JSX expressions on modifiers when the class strings are literals: ```tsx ``` `class:loading={isLoading}` is native Svelte and must not be converted to a string attribute. ## Blade ```blade {{-- Before --}} {{ $label }} {{-- After --}} {{ $label }} ``` ## Chained modifiers match Tailwind composition ```html ``` ```html ``` ## Arbitrary variants as modifiers Use bracket-aware attribute names for arbitrary variants (including `=` inside `[…]`): ```html ``` ```tsx ```