Skip to content

Commit 8122837

Browse files
Allow simple utilities with numbers in Oxide (#15110)
Fixes #15072 --------- Co-authored-by: Philipp Spiess <[email protected]>
1 parent 0c7088e commit 8122837

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- 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))
1414
- Don't print minified code when the build fails in the CLI ([#15106](https://github.com/tailwindlabs/tailwindcss/pull/15106))
1515
- Generate the correct CSS for the `break-keep` utility ([#15108](https://github.com/tailwindlabs/tailwindcss/pull/15108))
16+
- Pick up utilities with numbers when scanning files ([#15110](https://github.com/tailwindlabs/tailwindcss/pull/15110))
1617
- _Upgrade (experimental)_: Always add `layer(…)` as the first param to `@import` ([#15102](https://github.com/tailwindlabs/tailwindcss/pull/15102))
1718

1819
### Changed

crates/oxide/src/parser.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ impl<'a> Extractor<'a> {
255255
if candidate.iter().all(|c| c.is_ascii_alphanumeric())
256256
&& candidate
257257
.iter()
258-
.any(|c| c.is_ascii_uppercase() || c.is_ascii_digit())
258+
.any(|c| c.is_ascii_uppercase())
259259
{
260260
return ValidationResult::Invalid;
261261
}
262262

263263
// Reject candidates that look like SVG path data, e.g.: `m32.368 m7.5`
264264
if !candidate.contains(&b'-')
265265
&& !candidate.contains(&b':')
266-
&& candidate.iter().any(|c| c == &b'.' || c.is_ascii_digit())
266+
&& candidate.iter().any(|c| c == &b'.')
267267
{
268268
return ValidationResult::Invalid;
269269
}
@@ -1539,4 +1539,21 @@ mod test {
15391539
]
15401540
);
15411541
}
1542+
1543+
#[test]
1544+
fn simple_utility_names_with_numbers_work() {
1545+
let candidates = run(
1546+
r#"<div class="h2 hz"></div>"#,
1547+
false,
1548+
);
1549+
assert_eq!(
1550+
candidates,
1551+
vec![
1552+
"div",
1553+
"class",
1554+
"h2",
1555+
"hz",
1556+
]
1557+
);
1558+
}
15421559
}

0 commit comments

Comments
 (0)