Class: FoxTail::ClassnameMerger
- Inherits:
-
Object
- Object
- FoxTail::ClassnameMerger
- Defined in:
- lib/fox_tail/classname_merger.rb
Overview
Tailwind CSS class name merger
Instance Method Summary collapse
-
#initialize ⇒ ClassnameMerger
constructor
A new instance of ClassnameMerger.
-
#merge(*classes) ⇒ Object
Merge Tailwind class names removing any styling conflicts.
Constructor Details
#initialize ⇒ ClassnameMerger
Returns a new instance of ClassnameMerger.
8 9 10 |
# File 'lib/fox_tail/classname_merger.rb', line 8 def initialize @base_merger = TailwindMerge::Merger.new end |
Instance Method Details
#merge(*classes) ⇒ Object
Merge Tailwind class names removing any styling conflicts
13 14 15 16 17 18 |
# File 'lib/fox_tail/classname_merger.rb', line 13 def merge(*classes) normalized = classes.flatten.select { |c| c.present? && c.is_a?(String) } return nil if normalized.empty? @base_merger.merge normalized.join(" ") end |