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
  dcec2b83_4e72_642d_7b3b_bdf84c8a3bbf["test_extract_used_css_variables_from_css()"]
  6b48c515_a72f_7a7d_7ea7_b80f71a82b19["scanner.rs"]
  dcec2b83_4e72_642d_7b3b_bdf84c8a3bbf -->|defined in| 6b48c515_a72f_7a7d_7ea7_b80f71a82b19
  56624ac4_6945_32d1_2b96_700de264829d["create_files_in()"]
  dcec2b83_4e72_642d_7b3b_bdf84c8a3bbf -->|calls| 56624ac4_6945_32d1_2b96_700de264829d
  0ffee7bc_8829_8e8e_00ee_4a8f4e4d9736["public_source_entry_from_pattern()"]
  dcec2b83_4e72_642d_7b3b_bdf84c8a3bbf -->|calls| 0ffee7bc_8829_8e8e_00ee_4a8f4e4d9736
  89cd8369_536c_74e5_91d1_719df04e4597["scan()"]
  dcec2b83_4e72_642d_7b3b_bdf84c8a3bbf -->|calls| 89cd8369_536c_74e5_91d1_719df04e4597
  style dcec2b83_4e72_642d_7b3b_bdf84c8a3bbf 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