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
  68236e29_aceb_b148_a990_2702ef1ebc43["test_extract_used_css_variables_from_css()"]
  96c928f4_eee8_bcbc_0339_e2dce4b2d810["create_files_in()"]
  68236e29_aceb_b148_a990_2702ef1ebc43 -->|calls| 96c928f4_eee8_bcbc_0339_e2dce4b2d810
  257cbf08_9e94_64b3_97f2_0416460fab35["public_source_entry_from_pattern()"]
  68236e29_aceb_b148_a990_2702ef1ebc43 -->|calls| 257cbf08_9e94_64b3_97f2_0416460fab35
  1581ed51_04e1_62c1_6e26_ea43cf82d5f9["scan()"]
  68236e29_aceb_b148_a990_2702ef1ebc43 -->|calls| 1581ed51_04e1_62c1_6e26_ea43cf82d5f9
  style 68236e29_aceb_b148_a990_2702ef1ebc43 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.
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