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
  2b8fe916_a84e_706b_18ef_0117dfba0273["strip()"]
  714a3a15_03d5_1e35_b535_53da70bce8eb["gitignore.rs"]
  2b8fe916_a84e_706b_18ef_0117dfba0273 -->|defined in| 714a3a15_03d5_1e35_b535_53da70bce8eb
  cced25a4_cbaa_d0f2_f8a1_b7c0915c5f31["matched()"]
  cced25a4_cbaa_d0f2_f8a1_b7c0915c5f31 -->|calls| 2b8fe916_a84e_706b_18ef_0117dfba0273
  ca3cd87a_abf8_113a_8b00_c0db25a19976["matched_path_or_any_parents()"]
  ca3cd87a_abf8_113a_8b00_c0db25a19976 -->|calls| 2b8fe916_a84e_706b_18ef_0117dfba0273
  style 2b8fe916_a84e_706b_18ef_0117dfba0273 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, defined in crates/ignore/src/gitignore.rs.
Where is strip() defined?
strip() is defined in crates/ignore/src/gitignore.rs at line 273.
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