Home / Function/ extract_variables_from_css() — tailwindcss Function Reference

extract_variables_from_css() — tailwindcss Function Reference

Architecture documentation for the extract_variables_from_css() function in mod.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  1bd3d67b_c3ea_98e9_4167_108013772741["extract_variables_from_css()"]
  0fcd0fda_f6d1_052f_9575_133f5b2763a7["mod.rs"]
  1bd3d67b_c3ea_98e9_4167_108013772741 -->|defined in| 0fcd0fda_f6d1_052f_9575_133f5b2763a7
  style 1bd3d67b_c3ea_98e9_4167_108013772741 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/extractor/mod.rs lines 143–176

    pub fn extract_variables_from_css(&mut self) -> Vec<Extracted<'a>> {
        let mut extracted = Vec::with_capacity(100);

        let len = self.cursor.input.len();

        let cursor = &mut self.cursor.clone();
        while cursor.pos < len {
            if cursor.curr.is_ascii_whitespace() {
                cursor.advance();
                continue;
            }

            if let MachineState::Done(span) = self.css_variable_machine.next(cursor) {
                // We are only interested in variables that are used, not defined. Therefore we
                // need to ensure that the variable is prefixed with `var(`.
                if span.start < 4 {
                    cursor.advance();
                    continue;
                }

                let slice_before = Span::new(span.start - 4, span.start - 1);
                if !slice_before.slice(self.cursor.input).starts_with(b"var(") {
                    cursor.advance();
                    continue;
                }

                extracted.push(Extracted::CssVariable(span.slice(self.cursor.input)));
            }

            cursor.advance();
        }

        extracted
    }

Domain

Subdomains

Frequently Asked Questions

What does extract_variables_from_css() do?
extract_variables_from_css() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/mod.rs.
Where is extract_variables_from_css() defined?
extract_variables_from_css() is defined in crates/oxide/src/extractor/mod.rs at line 143.

Analyze Your Own Codebase

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

Try Supermodel Free