Skip to content

Arbitrary value type inference for polymorphic utilities #22

@goulvenclech

Description

@goulvenclech

Some Tailwind CSS v4 utility prefixes are polymorphic — the CSS property emitted depends on the value type inside brackets:

  • text-[#f00]color: #f00 (colour)
  • text-[14px]font-size: 14px (length)
  • bg-[#f00]background-color: #f00 (colour)
  • bg-[url(...)]background-image: url(...) (url)

The engine needs to:

  1. Detect value type from raw bracket content (colour, length, percentage, url, etc.)
  2. Dispatch to the correct CSS property based on inferred type
  3. Support explicit type hints as override: bg-[color:var(--my-bg)], text-[length:var(--size)]

Depends on #20.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions