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
  0b3f6487_075d_40cd_b117_5087a3b5c6e6["isBackgroundSize()"]
  2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"]
  0b3f6487_075d_40cd_b117_5087a3b5c6e6 -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66
  f09c1b77_2ead_f9c9_7d05_4f8bab47f7ca["isLength()"]
  0b3f6487_075d_40cd_b117_5087a3b5c6e6 -->|calls| f09c1b77_2ead_f9c9_7d05_4f8bab47f7ca
  94b3e523_3675_a597_3668_598a53b432d1["isPercentage()"]
  0b3f6487_075d_40cd_b117_5087a3b5c6e6 -->|calls| 94b3e523_3675_a597_3668_598a53b432d1
  style 0b3f6487_075d_40cd_b117_5087a3b5c6e6 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
}

Subdomains

Frequently Asked Questions

What does isBackgroundSize() do?
isBackgroundSize() is a function in the tailwindcss codebase.
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