Home / Function/ test_extract_used_css_variables_from_css() — tailwindcss Function Reference

test_extract_used_css_variables_from_css() — tailwindcss Function Reference

Architecture documentation for the test_extract_used_css_variables_from_css() function in scanner.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  4452cc24_cc6f_03b4_7d1a_d433db0db1c7["test_extract_used_css_variables_from_css()"]
  340ddba0_15e4_a309_9dea_cf6d6e73381d["scanner.rs"]
  4452cc24_cc6f_03b4_7d1a_d433db0db1c7 -->|defined in| 340ddba0_15e4_a309_9dea_cf6d6e73381d
  a055cb70_8b14_31db_b201_57369f5fda5a["create_files_in()"]
  4452cc24_cc6f_03b4_7d1a_d433db0db1c7 -->|calls| a055cb70_8b14_31db_b201_57369f5fda5a
  773530fa_5b76_d390_68d3_405d48fbecf7["public_source_entry_from_pattern()"]
  4452cc24_cc6f_03b4_7d1a_d433db0db1c7 -->|calls| 773530fa_5b76_d390_68d3_405d48fbecf7
  2f3305c3_ad36_6002_daa9_52b16e0424fd["scan()"]
  4452cc24_cc6f_03b4_7d1a_d433db0db1c7 -->|calls| 2f3305c3_ad36_6002_daa9_52b16e0424fd
  style 4452cc24_cc6f_03b4_7d1a_d433db0db1c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/tests/scanner.rs lines 1765–1797

    fn test_extract_used_css_variables_from_css() {
        let dir = tempdir().unwrap().into_path();
        create_files_in(
            &dir,
            &[
                (
                    "src/index.css",
                    r#"
                        @theme {
                            --color-red: #ff0000; /* Not used, so don't extract */
                            --color-green: #00ff00; /* Not used, so don't extract */
                        }

                        .button {
                            color: var(--color-red); /* Used, so extract */
                        }
                    "#,
                ),
                ("src/used-at-start.css", "var(--color-used-at-start)"),
                // Here to verify that we don't crash when trying to find `var(` in front of the
                // variable.
                ("src/defined-at-start.css", "--color-defined-at-start: red;"),
            ],
        );

        let mut scanner = Scanner::new(vec![public_source_entry_from_pattern(
            dir.clone(),
            "@source './'",
        )]);
        let candidates = scanner.scan();

        assert_eq!(candidates, vec!["--color-red", "--color-used-at-start"]);
    }

Domain

Subdomains

Frequently Asked Questions

What does test_extract_used_css_variables_from_css() do?
test_extract_used_css_variables_from_css() is a function in the tailwindcss codebase, defined in crates/oxide/tests/scanner.rs.
Where is test_extract_used_css_variables_from_css() defined?
test_extract_used_css_variables_from_css() is defined in crates/oxide/tests/scanner.rs at line 1765.
What does test_extract_used_css_variables_from_css() call?
test_extract_used_css_variables_from_css() calls 3 function(s): create_files_in, public_source_entry_from_pattern, scan.

Analyze Your Own Codebase

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

Try Supermodel Free