diff --git a/CHANGELOG.md b/CHANGELOG.md index 68a1143d06df..4d76daf0fb56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Allow `_` before numbers during candidate extraction ([#17961](https://github.com/tailwindlabs/tailwindcss/pull/17961)) ## [4.1.6] - 2025-05-09 diff --git a/crates/oxide/src/extractor/named_utility_machine.rs b/crates/oxide/src/extractor/named_utility_machine.rs index e92baac2ae2c..7c847a2e2915 100644 --- a/crates/oxide/src/extractor/named_utility_machine.rs +++ b/crates/oxide/src/extractor/named_utility_machine.rs @@ -279,7 +279,11 @@ impl Machine for NamedUtilityMachine { Class::Number => { if !matches!( cursor.prev.into(), - Class::Dash | Class::Dot | Class::Number | Class::AlphaLower + Class::Dash + | Class::Underscore + | Class::Dot + | Class::Number + | Class::AlphaLower ) { return self.restart(); } @@ -415,6 +419,9 @@ mod tests { // With numbers ("px-5", vec!["px-5"]), ("px-2.5", vec!["px-2.5"]), + // Underscores followed by numbers + ("header_1", vec!["header_1"]), + ("header_1_2", vec!["header_1_2"]), // With number followed by dash or underscore ("text-title1-strong", vec!["text-title1-strong"]), ("text-title1_strong", vec!["text-title1_strong"]),