Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Handle utilities with 1 keys in a JS config#19254

Open
thecrypticace wants to merge 3 commits into
maintailwindlabs/tailwindcss:mainfrom
fix/issue-19250tailwindlabs/tailwindcss:fix/issue-19250Copy head branch name to clipboard
Open

Handle utilities with 1 keys in a JS config#19254
thecrypticace wants to merge 3 commits into
maintailwindlabs/tailwindcss:mainfrom
fix/issue-19250tailwindlabs/tailwindcss:fix/issue-19250Copy head branch name to clipboard

Conversation

@thecrypticace

Copy link
Copy Markdown
Contributor

Fixes #19250

When converting a JS config to a series of theme keys we special case a key of 1, treat it as if it were tuple access, and turn that into nested theme keys.

This isn't 100% correct though because a user can use 1 in an object instead of an array — in which case we should generate normal theme keys with a 1 in the variable name instead of one with a nested theme key separator (--).

Because the conversion works based on key paths we need to treat a path like colors.a.1.b as both --color-a-1-b and --color-a--b. This ensures a utility like text-a-1-b works as expected.

@thecrypticace
thecrypticace marked this pull request as ready for review November 4, 2025 16:30
@thecrypticace
thecrypticace requested a review from a team as a code owner November 4, 2025 16:30

@philipp-spiess philipp-spiess left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense. It's gross, sure, but at least it's contained in the compat layer.

@thecrypticace

Copy link
Copy Markdown
Contributor Author

I'm gonna try to come up with a better design for this because I'm not a big fan of this implementation. I'd like to use actual type information when generating the theme keys from the config.

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.

v4: A theme key of 1 does not work in JS configs

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.