File tree Expand file tree Collapse file tree 4 files changed +5
-1
lines changed Expand file tree Collapse file tree 4 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,8 @@ The `tailwind_merge` config is an object with several keys:
189
189
tailwind_merge_config = {
190
190
# ↓ *Optional* Define how many values should be stored in cache.
191
191
cache_size: 500,
192
+ # ↓ *Optional* Enable or disable caching nil values.
193
+ ignore_empty_cache: true,
192
194
# ↓ *Optional* modifier separator from Tailwind config
193
195
separator: ":",
194
196
# ↓ *Optional* prefix from Tailwind config
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def initialize(config: {})
26
26
end
27
27
28
28
@class_utils = TailwindMerge ::ClassUtils . new ( @config )
29
- @cache = LruRedux ::Cache . new ( @config [ :cache_size ] )
29
+ @cache = LruRedux ::Cache . new ( @config [ :cache_size ] , @config [ :ignore_empty_cache ] )
30
30
end
31
31
32
32
def merge ( classes )
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ module Config
84
84
85
85
DEFAULTS = {
86
86
cache_size : 500 ,
87
+ ignore_empty_cache : true ,
87
88
separator : ":" ,
88
89
theme : {
89
90
"colors" => [ IS_ANY ] ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ def test_default_config_has_correct_types
7
7
config = TailwindMerge ::Config ::DEFAULTS
8
8
9
9
assert_equal ( 500 , config [ :cache_size ] )
10
+ assert ( config [ :ignore_empty_cache ] )
10
11
refute ( config [ :nonexistent ] )
11
12
assert_equal ( "block" , config [ :class_groups ] [ "display" ] . first )
12
13
assert_equal ( "auto" , config [ :class_groups ] [ "overflow" ] . first [ "overflow" ] . first )
You can’t perform that action at this time.
0 commit comments