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
  d45aaf33_d0f0_8994_bfd6_6988593b21ca["strip()"]
  8ec5ccab_4c41_0d11_dfea_bf7d548be815["matched()"]
  8ec5ccab_4c41_0d11_dfea_bf7d548be815 -->|calls| d45aaf33_d0f0_8994_bfd6_6988593b21ca
  73d594dd_e22d_f2c0_a6a6_f44c8bc42078["matched_path_or_any_parents()"]
  73d594dd_e22d_f2c0_a6a6_f44c8bc42078 -->|calls| d45aaf33_d0f0_8994_bfd6_6988593b21ca
  style d45aaf33_d0f0_8994_bfd6_6988593b21ca 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
    }

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