Allow simple utilities with numbers in Oxide (#15110)

Fixes #15072

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This commit is contained in:
Jordan Pittman 2024-11-22 11:05:24 -05:00 • committed by GitHub
parent 0c7088ed5d
commit 8122837dde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 2 deletions

View file

@ -13,6 +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 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

View file

@ -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#"<div class="h2 hz"></div>"#,
false,
);
assert_eq!(
candidates,
vec![
"div",
"class",
"h2",
"hz",
]
);
}
}