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 b5040254_6a87_4f17_6fb9_bd076880998b["split_pattern()"] 32fd280d_8a0c_065c_78a7_8bfcab67fb4f["hoist_static_glob_parts()"] 32fd280d_8a0c_065c_78a7_8bfcab67fb4f -->|calls| b5040254_6a87_4f17_6fb9_bd076880998b style b5040254_6a87_4f17_6fb9_bd076880998b 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