Home / Function/ test_slim_pre_processor() — tailwindcss Function Reference

test_slim_pre_processor() — tailwindcss Function Reference

Architecture documentation for the test_slim_pre_processor() function in slim.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  73e49379_e0fb_350d_20cc_755dddca3751["test_slim_pre_processor()"]
  728c6622_d993_001c_2e5b_541b85f1c521["slim.rs"]
  73e49379_e0fb_350d_20cc_755dddca3751 -->|defined in| 728c6622_d993_001c_2e5b_541b85f1c521
  style 73e49379_e0fb_350d_20cc_755dddca3751 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/extractor/pre_processors/slim.rs lines 147–190

    fn test_slim_pre_processor() {
        for (input, expected) in [
            // Convert dots to spaces
            ("div.flex.bg-red-500", "div flex bg-red-500"),
            (".flex.bg-red-500", " flex bg-red-500"),
            (".bg-red-500.2xl:flex", " bg-red-500 2xl:flex"),
            (
                ".bg-red-500.2xl:flex.bg-green-200.3xl:flex",
                " bg-red-500 2xl:flex bg-green-200 3xl:flex",
            ),
            // Keep dots in strings
            (r#"div(class="px-2.5")"#, r#"div class="px-2.5")"#),
            // Replace top-level `(a-z0-9)[` with `$1 `. E.g.: `.flex[x]` -> `.flex x]`
            (".text-xl.text-red-600[", " text-xl text-red-600 "),
            // But keep important brackets:
            (".text-[#0088cc]", " text-[#0088cc]"),
            // Arbitrary value and arbitrary modifier
            (
                ".text-[#0088cc].bg-[#0088cc]/[20%]",
                " text-[#0088cc] bg-[#0088cc]/[20%]",
            ),
            // Start of arbitrary property
            ("[color:red]", "[color:red]"),
            // Arbitrary container query
            ("@[320px]:flex", "@[320px]:flex"),
            // Nested brackets
            (
                "bg-[url(https://example.com/?q=[1,2])]",
                "bg-[url(https://example.com/?q=[1,2])]",
            ),
            // Nested brackets, with "invalid" syntax but valid due to nesting
            ("content-['50[]']", "content-['50[]']"),
            // Escaped string
            ("content-['a\'b\'c\'']", "content-['a\'b\'c\'']"),
            // Classes in HTML attributes
            ("<div id=\"px-2.5\"></div>", "<div id=\"px-2.5\"></div>"),
            (
                "<div id=\"px-2.5 bg-red-500 2xl:flex bg-green-200 3xl:flex\"></div>",
                "<div id=\"px-2.5 bg-red-500 2xl:flex bg-green-200 3xl:flex\"></div>",
            ),
        ] {
            Slim::test(input, expected);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does test_slim_pre_processor() do?
test_slim_pre_processor() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/pre_processors/slim.rs.
Where is test_slim_pre_processor() defined?
test_slim_pre_processor() is defined in crates/oxide/src/extractor/pre_processors/slim.rs at line 147.

Analyze Your Own Codebase

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

Try Supermodel Free