Home / Function/ mergeThemeExtension() — tailwindcss Function Reference

mergeThemeExtension() — tailwindcss Function Reference

Architecture documentation for the mergeThemeExtension() function in resolve-config.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  b16566fb_b078_7bbb_de84_44baf6fd3c21["mergeThemeExtension()"]
  21757970_4272_76c4_4694_eec1d8abb2f6["isPlainObject()"]
  b16566fb_b078_7bbb_de84_44baf6fd3c21 -->|calls| 21757970_4272_76c4_4694_eec1d8abb2f6
  style b16566fb_b078_7bbb_de84_44baf6fd3c21 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/compat/config/resolve-config.ts lines 102–128

export function mergeThemeExtension(
  themeValue: ThemeValue | ThemeValue[],
  extensionValue: ThemeValue | ThemeValue[],
) {
  // When we have an array of objects, we do want to merge it
  if (Array.isArray(themeValue) && isPlainObject(themeValue[0])) {
    return themeValue.concat(extensionValue)
  }

  // When the incoming value is an array, and the existing config is an object,
  // prepend the existing object
  if (
    Array.isArray(extensionValue) &&
    isPlainObject(extensionValue[0]) &&
    isPlainObject(themeValue)
  ) {
    return [themeValue, ...extensionValue]
  }

  // Override arrays (for example for font-families, box-shadows, ...)
  if (Array.isArray(extensionValue)) {
    return extensionValue
  }

  // Execute default behavior
  return undefined
}

Domain

Subdomains

Frequently Asked Questions

What does mergeThemeExtension() do?
mergeThemeExtension() is a function in the tailwindcss codebase.
What does mergeThemeExtension() call?
mergeThemeExtension() calls 1 function(s): isPlainObject.

Analyze Your Own Codebase

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

Try Supermodel Free