Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Replace `_` with `.` in theme suggestions for `@utility` if surrounded by digits ([#17743](https://github.com/tailwindlabs/tailwindcss/pull/17743))
- Upgrade: Bump all Tailwind CSS related dependencies during upgrade ([#17763](https://github.com/tailwindlabs/tailwindcss/pull/17763))
- PostCSS: Ensure that errors in stylesheet dependencies are recoverable ([#17754](https://github.com/tailwindlabs/tailwindcss/pull/17754))
- Upgrade: Correctly print variants starting with `@` ([#17814](https://github.com/tailwindlabs/tailwindcss/pull/17814))

## [4.1.4] - 2025-04-14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ const variants = [
['[&:is(_p_)]:', '[p]:'],
['has-[&:is(p)]:', 'has-[p]:'],
['has-[&:is(_p_)]:', 'has-[p]:'],

// Handle special `@` variants. These shouldn't be printed as `@-`
['@xl:', '@xl:'],
['@[123px]:', '@[123px]:'],
]

let combinations: [string, string][] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,18 @@ function printVariant(variant: Variant) {
// Handle functional variants
if (variant.kind === 'functional') {
base += variant.root
// `@` is a special case for functional variants. We want to print: `@lg`
// instead of `@-lg`
let hasDash = variant.root !== '@'
if (variant.value) {
if (variant.value.kind === 'arbitrary') {
let isVarValue = isVar(variant.value.value)
let value = isVarValue ? variant.value.value.slice(4, -1) : variant.value.value
let [open, close] = isVarValue ? ['(', ')'] : ['[', ']']

base += `-${open}${printArbitraryValue(value)}${close}`
base += `${hasDash ? '-' : ''}${open}${printArbitraryValue(value)}${close}`
} else if (variant.value.kind === 'named') {
base += `-${variant.value.value}`
base += `${hasDash ? '-' : ''}${variant.value.value}`
}
}
}
Expand Down