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 @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Do not extract candidates with JS string interpolation `${` ([#17142](https://github.com/tailwindlabs/tailwindcss/pull/17142))
- Fix extraction of variants containing `.` character ([#17153](https://github.com/tailwindlabs/tailwindcss/pull/17153))

## [4.0.13] - 2025-03-11

Expand Down
30 changes: 18 additions & 12 deletions crates/oxide/src/extractor/named_variant_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,22 @@ impl Machine for NamedVariantMachine<ParsingState> {
// ^
Class::Colon => return self.done(self.start_pos, cursor),

// A dot must be surrounded by numbers
//
// E.g.: `2.5xl:flex`
// ^^^
Class::Dot => {
if !matches!(cursor.prev.into(), Class::Number) {
return self.restart();
}

if !matches!(cursor.next.into(), Class::Number) {
return self.restart();
}

cursor.advance();
}

// Everything else is invalid
_ => return self.restart(),
};
Expand Down Expand Up @@ -325,24 +341,15 @@ enum Class {
#[bytes(b'.')]
Dot,

#[bytes(b'\0')]
End,

#[bytes_range(b'0'..=b'9')]
Number,

#[bytes(b'[')]
OpenBracket,

#[bytes(b']')]
CloseBracket,

#[bytes(b'(')]
OpenParen,

#[bytes(b'\'', b'"', b'`')]
Quote,

#[bytes(b'*')]
Star,

Expand All @@ -352,9 +359,6 @@ enum Class {
#[bytes(b'_')]
Underscore,

#[bytes(b' ', b'\t', b'\n', b'\r', b'\x0C')]
Whitespace,

#[fallback]
Other,
}
Expand Down Expand Up @@ -391,6 +395,8 @@ mod tests {
vec!["group-[data-state=pending]/name:"],
),
("supports-(--foo)/name:flex", vec!["supports-(--foo)/name:"]),
// Odd media queries
("1.5xl:flex", vec!["1.5xl:"]),
// Container queries
("@md:flex", vec!["@md:"]),
("@max-md:flex", vec!["@max-md:"]),
Expand Down