From 8d9dc330d317380eeb2b0479fd333b357a6ce01c Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 22 Nov 2024 10:41:27 -0500 Subject: [PATCH 1/3] Allow simple utilities with numbers in Oxide --- crates/oxide/src/parser.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/oxide/src/parser.rs b/crates/oxide/src/parser.rs index 8e659a258225..e49b2d21c891 100644 --- a/crates/oxide/src/parser.rs +++ b/crates/oxide/src/parser.rs @@ -255,7 +255,7 @@ impl<'a> Extractor<'a> { if candidate.iter().all(|c| c.is_ascii_alphanumeric()) && candidate .iter() - .any(|c| c.is_ascii_uppercase() || c.is_ascii_digit()) + .any(|c| c.is_ascii_uppercase()) { return ValidationResult::Invalid; } @@ -263,7 +263,7 @@ impl<'a> Extractor<'a> { // Reject candidates that look like SVG path data, e.g.: `m32.368 m7.5` if !candidate.contains(&b'-') && !candidate.contains(&b':') - && candidate.iter().any(|c| c == &b'.' || c.is_ascii_digit()) + && candidate.iter().any(|c| c == &b'.') { return ValidationResult::Invalid; } @@ -1539,4 +1539,21 @@ mod test { ] ); } + + #[test] + fn simple_utility_names_with_numbers_work() { + let candidates = run( + r#"
"#, + false, + ); + assert_eq!( + candidates, + vec![ + "div", + "class", + "h2", + "hz", + ] + ); + } } From 3b6cb145d04f55a47557d814d37355508b1e3c49 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 22 Nov 2024 10:43:05 -0500 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6010f06b487..015e48ea276d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use configured `--letter-spacing` values for custom font size utilities ([#15099](https://github.com/tailwindlabs/tailwindcss/pull/15099)) - Ensure `space-x/y-*` and `divide-x/y-*` with variants can undo `space-x/y-reverse` and `divide-x/y-reverse` ([#15094](https://github.com/tailwindlabs/tailwindcss/pull/15094)) +- Pick up simple utilities with numbers when scanning files ([#15110](https://github.com/tailwindlabs/tailwindcss/pull/15110)) - _Upgrade (experimental)_: Always add `layer(…)` as the first param to `@import` ([#15102](https://github.com/tailwindlabs/tailwindcss/pull/15102)) ### Changed From 0c06519637f31590440195b77394ce8061f39d4f Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 22 Nov 2024 11:04:55 -0500 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Philipp Spiess --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 544517ae1166..9f6db392e509 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ensure `space-x/y-*` and `divide-x/y-*` with variants can undo `space-x/y-reverse` and `divide-x/y-reverse` ([#15094](https://github.com/tailwindlabs/tailwindcss/pull/15094)) - Don't print minified code when the build fails in the CLI ([#15106](https://github.com/tailwindlabs/tailwindcss/pull/15106)) - Generate the correct CSS for the `break-keep` utility ([#15108](https://github.com/tailwindlabs/tailwindcss/pull/15108)) -- Pick up simple utilities with numbers when scanning files ([#15110](https://github.com/tailwindlabs/tailwindcss/pull/15110)) +- Pick up utilities with numbers when scanning files ([#15110](https://github.com/tailwindlabs/tailwindcss/pull/15110)) - _Upgrade (experimental)_: Always add `layer(…)` as the first param to `@import` ([#15102](https://github.com/tailwindlabs/tailwindcss/pull/15102)) ### Changed