tailwind-merge-recipe

Extend tailwind-merge with custom theme keys and regex validators for CSS variable tokens.

Updated Mar 22, 2018
One-click install
npx skills add https://github.com/tnunamak/dotfiles --skill tailwind-merge-recipe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tailwind-merge-recipe
Source: https://github.com/tnunamak/dotfiles/tree/main/ai/skills/local/tailwind-merge-recipe
Command: npx skills add https://github.com/tnunamak/dotfiles --skill tailwind-merge-recipe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tailwind class merging can break when you use custom CSS variable tokens, leading to incorrect or conflicting utility classes.

Core Features & Use Cases

  • Extends tailwind-merge behavior: Adds custom theme keys and validator functions so Tailwind utilities match your design tokens.
  • Prevents class conflicts: Ensures tokens like custom colors, spacing, and typography merge correctly instead of producing unintended duplicates.
  • Works with dynamic token naming: Uses regex-based validators to cover families of utilities rather than only fixed allowlists.

Quick Start

Paste the provided extendTailwindMerge configuration into your project, then import and use cn(...) when composing Tailwind class strings that include your custom CSS variable-based utilities.

Frequently Asked Questions about tailwind-merge-recipe

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does tailwind-merge fail to resolve conflicts between my custom CSS variable utilities?

tailwind-merge fails to resolve conflicts between custom CSS variable utilities because it does not recognize custom token namespaces by default. You must extend its configuration with custom theme keys and regex validators so the engine treats your custom tokens as the same utility group.

How do I configure tailwind-merge to handle custom Tailwind theme tokens correctly?

To configure tailwind-merge for custom Tailwind theme tokens, paste the provided extendTailwindMerge configuration into your project and use the resulting cn() function to compose class strings. This adds validator functions that match your custom design tokens.

When do I need to extend tailwind-merge with custom validators for Tailwind classes?

You need to extend tailwind-merge with custom validators when your Tailwind utilities represent custom CSS variable tokens or theme extensions, specifically for text sizes, colors, spacing, and radii defined via custom token naming patterns that cause class merging conflicts.

Can tailwind-merge apply regex validators to dynamic custom token naming patterns?

Yes, tailwind-merge can apply regex-based validators to handle dynamic custom token naming patterns. This allows the merge engine to cover entire families of utilities based on pattern matching rather than relying on fixed allowlists for conflict resolution.

Does this tailwind class merging fix work for all custom CSS variable tokens?

This tailwind class merging fix applies to custom CSS variable tokens representing text sizes, colors, spacing, and radii. It requires extending tailwind-merge with specific extend mappings and value validators to correctly identify and merge your custom utility groups.