Home / Function/ isBackgroundSize() — tailwindcss Function Reference

isBackgroundSize() — tailwindcss Function Reference

Architecture documentation for the isBackgroundSize() function in infer-data-type.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  95eed32f_b899_a9b6_6208_5de3f49f62f9["isBackgroundSize()"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00["infer-data-type.ts"]
  95eed32f_b899_a9b6_6208_5de3f49f62f9 -->|defined in| 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  c58cbb33_f3cc_0b4f_844a_15bf66a1dc61["segment()"]
  95eed32f_b899_a9b6_6208_5de3f49f62f9 -->|calls| c58cbb33_f3cc_0b4f_844a_15bf66a1dc61
  1892fde4_0ab4_2e7a_38c4_cf431005a033["isLength()"]
  95eed32f_b899_a9b6_6208_5de3f49f62f9 -->|calls| 1892fde4_0ab4_2e7a_38c4_cf431005a033
  6e5ca11b_0795_cec6_2d01_3fe0ccd21e05["isPercentage()"]
  95eed32f_b899_a9b6_6208_5de3f49f62f9 -->|calls| 6e5ca11b_0795_cec6_2d01_3fe0ccd21e05
  style 95eed32f_b899_a9b6_6208_5de3f49f62f9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/utils/infer-data-type.ts lines 285–308

function isBackgroundSize(value: string) {
  let count = 0

  for (let size of segment(value, ',')) {
    if (size === 'cover' || size === 'contain') {
      count += 1
      continue
    }

    let values = segment(size, ' ')

    // Sizes must have exactly one or two values
    if (values.length !== 1 && values.length !== 2) {
      return false
    }

    if (values.every((value) => value === 'auto' || isLength(value) || isPercentage(value))) {
      count += 1
      continue
    }
  }

  return count > 0
}

Domain

Subdomains

Frequently Asked Questions

What does isBackgroundSize() do?
isBackgroundSize() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/utils/infer-data-type.ts.
Where is isBackgroundSize() defined?
isBackgroundSize() is defined in packages/tailwindcss/src/utils/infer-data-type.ts at line 285.
What does isBackgroundSize() call?
isBackgroundSize() calls 3 function(s): isLength, isPercentage, segment.

Analyze Your Own Codebase

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

Try Supermodel Free