Module: Clsx::Twm

Defined in:
lib/clsx/tailwind_merge.rb

Overview

Bracket shortcut for Helper#twm, mirroring [].

Class Method Summary collapse

Class Method Details

.[]String?

Like Helper#clsx, but pipes the result through Clsx.merger to resolve conflicting Tailwind utilities. Returns nil (skipping the merger) when no classes apply, matching Helper#clsx.

Examples:

twm('px-2 px-4')                 # => "px-4"
twm('px-2', 'px-4', hidden: c)   # => "px-4"

Returns:

  • (String, nil)


59
60
61
# File 'lib/clsx/tailwind_merge.rb', line 59

def self.[](*)
  Clsx.twm(*)
end