Skip to content

Fix utility generaFix utility generation for escaped theme keystion for escaped theme keys#19587

Closed
KashviYadav09 wants to merge 1 commit intotailwindlabs:mainfrom
KashviYadav09:fix-escaped-theme-keys
Closed

Fix utility generaFix utility generation for escaped theme keystion for escaped theme keys#19587
KashviYadav09 wants to merge 1 commit intotailwindlabs:mainfrom
KashviYadav09:fix-escaped-theme-keys

Conversation

@KashviYadav09
Copy link

Summary

This PR fixes an issue where utilities are not generated when theme keys contain escaped special characters (e.g. brand\:primary).

Tailwind allows escaped characters in theme configuration keys, but named utility values were not being normalized before theme lookup, which caused matching to fail.

What’s changed

  • Added normalization for escaped theme keys
  • Ensured named utility values are unescaped before resolving against the theme
  • Added tests to cover escaped theme keys in configuration and utility generation

Example

// tailwind.config.js
theme: {
  colors: {
    'brand\\:primary': '#ff0000',
  },
}

@KashviYadav09 KashviYadav09 requested a review from a team as a code owner January 21, 2026 16:43
@RobinMalfait
Copy link
Member

Hey! Thanks for the PR, but going to say no to this one for now unless more people run into this issue.

While we can merge this and fix it, our Oxide scanner (the part that extracts classes from template files) won't pick up values such as bg-brand\:primary so this PR on its own won't fix the issue you are seeing. We can allow it in Oxide as well, but it would make things more complex.

This also introduces some new Tailwind CSS syntax that is unfamiliar. I would instead recommend to use bg-brand-primary. It's the same amount of characters but without the added complexity and it works as-is today.

If more people run into this then I'm more than happy to re evaluate, but for now I'm going to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants