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
  4220e834_b0a4_ab4d_5c39_b7b51b69e8cf["isBackgroundSize()"]
  516809a4_c70e_60c3_bbb2_8de4c4572510["infer-data-type.ts"]
  4220e834_b0a4_ab4d_5c39_b7b51b69e8cf -->|defined in| 516809a4_c70e_60c3_bbb2_8de4c4572510
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment()"]
  4220e834_b0a4_ab4d_5c39_b7b51b69e8cf -->|calls| f712ed47_45d4_4e5a_dd73_fdefa1da71da
  978cd83c_b489_4dd0_bddf_ab7b6f0970c6["isLength()"]
  4220e834_b0a4_ab4d_5c39_b7b51b69e8cf -->|calls| 978cd83c_b489_4dd0_bddf_ab7b6f0970c6
  62476965_f9ea_4906_7208_dd8bf9da2e20["isPercentage()"]
  4220e834_b0a4_ab4d_5c39_b7b51b69e8cf -->|calls| 62476965_f9ea_4906_7208_dd8bf9da2e20
  style 4220e834_b0a4_ab4d_5c39_b7b51b69e8cf 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, 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