cnfast
Fast drop in replacement for `cn`
What is it?
What it is
Fast drop-in replacement for the `cn` utility that merges Tailwind CSS class names with byte-identical output to `tailwind-merge` but runs significantly faster.
Why it exists
To provide a drop-in replacement for `cn`/`clsx`/`tailwind-merge` that reduces the cost of class merging in UI rendering loops, keeping frames within budget on data-grids, virtualized tables, live dashboards, and server-rendered pages while preserving the same API and output.
Who should use it
Developers using Tailwind CSS who need a faster class utility library replacement for clsx or tailwind-merge, especially in performance-sensitive applications like SPAs, server-rendered apps, or data grids.
Who should avoid it
Users who don't require performance optimizations, or those already satisfied with clsx/tailwind-merge without needing faster computation. Also unsuitable for non-Tailwind CSS projects.
How it works
A quick walkthrough in plain English
How cnfast works
Step 1 of 3
You interact with it
Open cnfast, send a request, or connect it to your stack.
Features
Advantages
- Significant performance gains, especially for re‑rendering call sites
- Zero code changes required due to identical API
- Built‑in caching reduces runtime overhead
- Easy migration with a single command
- Compatibility with existing tooling and libraries
- Maintains exact output semantics of `tailwind‑merge`
- Lightweight footprint
- Type safety via TypeScript
- Well‑documented and actively maintained
Disadvantages
- Performance benefits may vary across JavaScript engines (e.g., V8 vs. Bun)
- Requires migration command for legacy projects, which may add a step
- Relies on underlying `clsx` and `tailwind‑merge` implementations; any bugs there propagate
- Not as widely adopted as the original `cn` utility, potentially limiting community support
- License is marked `NOASSERTION`, which may keep some users uncertain about legal clarity
Installation
native
npm install cnfast npx cnfast migrate npx shadcn@latest add aidenybai/cnfast/cn
FAQ
What is cnfast?
cnfast is an open-source project licensed under NOASSERTION.
What language is cnfast built with?
Primary language: TypeScript.
Is it free to use?
Yes. Licensed under NOASSERTION. Check the license for commercial use.
Featured in Videos
YouTube tutorials and walkthroughs for cnfast
Alternatives
Similar projects ranked by category, topics, and text overlap.