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
  9bc62260_0f13_3c0e_30ff_4b4a5aa85a0c["isBackgroundSize()"]
  03b8d706_a876_a776_0056_186ced5d6067["segment()"]
  9bc62260_0f13_3c0e_30ff_4b4a5aa85a0c -->|calls| 03b8d706_a876_a776_0056_186ced5d6067
  b165f745_465e_eff8_6d0d_8cc7925672fb["isLength()"]
  9bc62260_0f13_3c0e_30ff_4b4a5aa85a0c -->|calls| b165f745_465e_eff8_6d0d_8cc7925672fb
  2e575c10_95fb_8398_4a75_13426712ebeb["isPercentage()"]
  9bc62260_0f13_3c0e_30ff_4b4a5aa85a0c -->|calls| 2e575c10_95fb_8398_4a75_13426712ebeb
  style 9bc62260_0f13_3c0e_30ff_4b4a5aa85a0c 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.
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