Home / Function/ strip() — tailwindcss Function Reference

strip() — tailwindcss Function Reference

Architecture documentation for the strip() function in gitignore.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  5b10a30b_cb6e_783d_3cb7_9269934d8149["strip()"]
  bcde51f1_24c3_24e7_4c92_5f3bdad5482e["matched()"]
  bcde51f1_24c3_24e7_4c92_5f3bdad5482e -->|calls| 5b10a30b_cb6e_783d_3cb7_9269934d8149
  9e0901b1_589e_f34e_e871_d74e148bffa5["matched_path_or_any_parents()"]
  9e0901b1_589e_f34e_e871_d74e148bffa5 -->|calls| 5b10a30b_cb6e_783d_3cb7_9269934d8149
  style 5b10a30b_cb6e_783d_3cb7_9269934d8149 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/gitignore.rs lines 273–299

    fn strip<'a, P: 'a + AsRef<Path> + ?Sized>(&'a self, path: &'a P) -> &'a Path {
        let mut path = path.as_ref();
        // A leading ./ is completely superfluous. We also strip it from
        // our gitignore root path, so we need to strip it from our candidate
        // path too.
        if let Some(p) = strip_prefix("./", path) {
            path = p;
        }
        // Strip any common prefix between the candidate path and the root
        // of the gitignore, to make sure we get relative matching right.
        // BUT, a file name might not have any directory components to it,
        // in which case, we don't want to accidentally strip any part of the
        // file name.
        //
        // As an additional special case, if the root is just `.`, then we
        // shouldn't try to strip anything, e.g., when path begins with a `.`.
        if self.root != Path::new(".") && !is_file_name(path) {
            if let Some(p) = strip_prefix(&self.root, path) {
                path = p;
                // If we're left with a leading slash, get rid of it.
                if let Some(p) = strip_prefix("/", path) {
                    path = p;
                }
            }
        }
        path
    }

Domain

Subdomains

Frequently Asked Questions

What does strip() do?
strip() is a function in the tailwindcss codebase.
What calls strip()?
strip() is called by 2 function(s): matched, matched_path_or_any_parents.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free