split_pattern() — tailwindcss Function Reference
Architecture documentation for the split_pattern() function in glob.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 61a7c913_3903_fa92_a9fb_2cd74704203e["split_pattern()"] 2f10b262_24d5_643d_e262_4238e7d8b5ff["hoist_static_glob_parts()"] 2f10b262_24d5_643d_e262_4238e7d8b5ff -->|calls| 61a7c913_3903_fa92_a9fb_2cd74704203e style 61a7c913_3903_fa92_a9fb_2cd74704203e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/glob.rs lines 157–187
pub fn split_pattern(pattern: &str) -> (Option<String>, Option<String>) {
// No dynamic parts, so we can just return the input as-is.
if !pattern.contains('*') {
return (Some(pattern.to_owned()), None);
}
let mut last_slash_position = None;
for (i, c) in pattern.char_indices() {
if c == '/' {
last_slash_position = Some(i);
}
if c == '*' || c == '!' {
break;
}
}
// Very first character is a `*`, therefore there is no static part, only a dynamic part.
let Some(last_slash_position) = last_slash_position else {
return (None, Some(pattern.to_owned()));
};
let static_part = pattern[..last_slash_position].to_owned();
let dynamic_part = pattern[last_slash_position + 1..].to_owned();
let static_part = (!static_part.is_empty()).then_some(static_part);
let dynamic_part = (!dynamic_part.is_empty()).then_some(dynamic_part);
(static_part, dynamic_part)
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does split_pattern() do?
split_pattern() is a function in the tailwindcss codebase.
What calls split_pattern()?
split_pattern() is called by 1 function(s): hoist_static_glob_parts.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free