Home / Function/ render() — tailwindcss Function Reference

render() — tailwindcss Function Reference

Architecture documentation for the render() function in ui.spec.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  811a05d1_74b6_db8d_9c62_35b3ec21cf16["render()"]
  214d4226_762c_0b6a_7c0b_f917da98dda0["compile()"]
  811a05d1_74b6_db8d_9c62_35b3ec21cf16 -->|calls| 214d4226_762c_0b6a_7c0b_f917da98dda0
  476b4032_f4b1_ac67_0f5a_372cd6083a1f["optimize()"]
  811a05d1_74b6_db8d_9c62_35b3ec21cf16 -->|calls| 476b4032_f4b1_ac67_0f5a_372cd6083a1f
  9791c381_c51f_7e1f_8db9_fae6f853c06d["getPropertyValue()"]
  811a05d1_74b6_db8d_9c62_35b3ec21cf16 -->|calls| 9791c381_c51f_7e1f_8db9_fae6f853c06d
  2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"]
  811a05d1_74b6_db8d_9c62_35b3ec21cf16 -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66
  style 811a05d1_74b6_db8d_9c62_35b3ec21cf16 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/tests/ui.spec.ts lines 2185–2245

async function render(page: Page, content: string, extraCss: string = '') {
  let { build } = await compile(css`
    @layer theme, base, components, utilities;
    @layer theme {
      ${defaultTheme}

      @theme {
        --color-red: rgb(255, 0, 0);
        --color-green: rgb(0, 255, 0);
        --color-blue: rgb(0, 0, 255);
        --color-black: black;
        --color-transparent: transparent;
      }
    }
    @layer base {
      ${preflight}
    }
    @layer utilities {
      @tailwind utilities;
    }
    ${extraCss}
  `)

  // We noticed that some of the tests depending on the `hover:` variant were
  // flaky. After some investigation, we found that injected elements had the
  // `:hover` state without us explicitly hovering over the element.
  //
  // To avoid this, we now set up an explicit placeholder element to move the
  // mouse to before running the tests.
  content = `<div id="mouse-park" class="size-12"></div>${content}`

  let scanner = new Scanner({})
  let candidates = scanner.scanFiles([{ content, extension: 'html' }])

  let { code: styles } = optimize(build(candidates))

  content = `<style type="text/css">${styles}</style>${content}`
  await page.setContent(content)

  await page.locator('#mouse-park').hover()

  return {
    getPropertyValue(selector: string | [string, string], property: string) {
      return getPropertyValue(
        page,
        Array.isArray(selector) ? selector : [selector, undefined],
        property,
      )
    },

    async getPropertyList(selector: string | [string, string], property: string) {
      let value = await getPropertyValue(
        page,
        Array.isArray(selector) ? selector : [selector, undefined],
        property,
      )

      return segment(value, ',').map((item) => item.trim())
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does render() do?
render() is a function in the tailwindcss codebase.
What does render() call?
render() calls 4 function(s): compile, getPropertyValue, optimize, segment.

Analyze Your Own Codebase

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

Try Supermodel Free