test_named_utility_extraction() — tailwindcss Function Reference
Architecture documentation for the test_named_utility_extraction() function in named_utility_machine.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 686c3ac5_0861_3715_5d59_436038561cc8["test_named_utility_extraction()"] bf0a5a81_9d4d_13f4_80cb_898fcfafbf69["named_utility_machine.rs"] 686c3ac5_0861_3715_5d59_436038561cc8 -->|defined in| bf0a5a81_9d4d_13f4_80cb_898fcfafbf69 style 686c3ac5_0861_3715_5d59_436038561cc8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/extractor/named_utility_machine.rs lines 408–534
fn test_named_utility_extraction() {
for (input, expected) in [
// Simple utility
("flex", vec!["flex"]),
// Simple utility with special character(s)
("@container", vec!["@container"]),
// Simple single-character utility
("a", vec!["a"]),
// With dashes
("items-center", vec!["items-center"]),
// With double dashes
("items--center", vec!["items--center"]),
// 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"]),
// With capital letter followed by number
("text-titleV1-strong", vec!["text-titleV1-strong"]),
// With trailing % sign
("from-15%", vec!["from-15%"]),
// Arbitrary value with bracket notation
("bg-[#0088cc]", vec!["bg-[#0088cc]"]),
// Arbitrary variable
("bg-(--my-color)", vec!["bg-(--my-color)"]),
// Arbitrary variable with fallback
("bg-(--my-color,red,blue)", vec!["bg-(--my-color,red,blue)"]),
// --------------------------------------------------------
// Exceptions:
// Arbitrary variable must be valid
(r"bg-(--my-color\)", vec![]),
(r"bg-(--my#color)", vec![]),
// Single letter utility with uppercase letter is invalid
("A", vec![]),
// A dot must be in-between numbers
("opacity-0.5", vec!["opacity-0.5"]),
("opacity-.5", vec![]),
("opacity-5.", vec![]),
// A number must be preceded by a `-`, `.` or another number
("text-2xs", vec!["text-2xs"]),
// Random invalid utilities
("-$", vec![]),
("-_", vec![]),
("-foo-", vec![]),
("foo-=", vec![]),
("foo-#", vec![]),
("foo-!", vec![]),
("foo-/20", vec![]),
("-", vec![]),
("--", vec![]),
("---", vec![]),
] {
for (wrapper, additional) in [
// No wrapper
("{}", vec![]),
// With leading spaces
(" {}", vec![]),
// With trailing spaces
("{} ", vec![]),
// Surrounded by spaces
(" {} ", vec![]),
// Inside a string
("'{}'", vec![]),
// Inside a function call
("fn('{}')", vec![]),
// Inside nested function calls
("fn1(fn2('{}'))", vec!["fn1", "fn2"]),
// --------------------------
//
// HTML
// Inside a class (on its own)
(r#"<div class="{}"></div>"#, vec!["div", "class"]),
// Inside a class (first)
(r#"<div class="{} foo"></div>"#, vec!["div", "class", "foo"]),
// Inside a class (second)
(r#"<div class="foo {}"></div>"#, vec!["div", "class", "foo"]),
Domain
Subdomains
Source
Frequently Asked Questions
What does test_named_utility_extraction() do?
test_named_utility_extraction() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/named_utility_machine.rs.
Where is test_named_utility_extraction() defined?
test_named_utility_extraction() is defined in crates/oxide/src/extractor/named_utility_machine.rs at line 408.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free