Skip to content

Fix container names with hyphens #17628

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged

Conversation

wongjn
Copy link
Collaborator

@wongjn wongjn commented Apr 9, 2025

Fixes #17614.

Candidate parsing for variants only account for the root @ if there no hyphens. It seems like the current logic assumes if it does have a hyphen, then it would be one of @min or @max. However, with:

@theme {
  --container-foo-bar: 1440px;
}

Then @foo-bar should be valid. However, we only check for @foo-bar and @foo as roots, but never @. This PR adds a check for @ at the very end after iterating through root permutations.

@wongjn wongjn requested a review from a team as a code owner April 9, 2025 16:31
Comment on lines +781 to +785
// Try '@' variant after permutations. This allows things like `@max` of `@max-foo-bar`
// to match before looking for `@`.
if (input[0] === '@' && exists('@')) {
yield ['@', input.slice(1)]
}
Copy link
Member

Choose a reason for hiding this comment

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

I've been thinking of restructuring this somehow so that there's only one special-case for @. Let me know what you think about this (I pushed onto your PR). Tests seem to pass so it should be fine? 🤞

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I was thinking that there would probably be some way to have only one code path for @ 👍

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
@philipp-spiess philipp-spiess merged commit 3ab7f12 into tailwindlabs:main Apr 11, 2025
7 checks passed
@philipp-spiess
Copy link
Member

Great stuff, ty!

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hyphenated custom container sizes aren't handled properly
2 participants