Skip to content

Commit

Permalink
Merge pull request #48 from w-masahiro-ct/uninstall-lru-cache-and-ins…
Browse files Browse the repository at this point in the history
…tall-sin-lru-redux

Uninstall lru_cache and install sin_lru_redux
  • Loading branch information
gjtorikian authored Jan 23, 2025
2 parents bf1463b + 58e3d47 commit 1836845
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ The `tailwind_merge` config is an object with several keys:
tailwind_merge_config = {
# ↓ *Optional* Define how many values should be stored in cache.
cache_size: 500,
# ↓ *Optional* Enable or disable caching nil values.
ignore_empty_cache: true,
# ↓ *Optional* modifier separator from Tailwind config
separator: ":",
# ↓ *Optional* prefix from Tailwind config
Expand Down
2 changes: 1 addition & 1 deletion lib/tailwind_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def initialize(config: {})
end

@class_utils = TailwindMerge::ClassUtils.new(@config)
@cache = LruRedux::Cache.new(@config[:cache_size])
@cache = LruRedux::Cache.new(@config[:cache_size], @config[:ignore_empty_cache])
end

def merge(classes)
Expand Down
1 change: 1 addition & 0 deletions lib/tailwind_merge/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module Config

DEFAULTS = {
cache_size: 500,
ignore_empty_cache: true,
separator: ":",
theme: {
"colors" => [IS_ANY],
Expand Down
2 changes: 1 addition & 1 deletion lib/tailwind_merge/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module TailwindMerge
VERSION = "0.14.0"
VERSION = "0.15.0"
end
2 changes: 1 addition & 1 deletion tailwind_merge.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency("lru_redux", "~> 1.1")
spec.add_dependency("sin_lru_redux", "~> 2.5")

spec.add_development_dependency("minitest", "~> 5.6")
spec.add_development_dependency("minitest-focus", "~> 1.1")
Expand Down
1 change: 1 addition & 0 deletions test/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def test_default_config_has_correct_types
config = TailwindMerge::Config::DEFAULTS

assert_equal(500, config[:cache_size])
assert(config[:ignore_empty_cache])
refute(config[:nonexistent])
assert_equal("block", config[:class_groups]["display"].first)
assert_equal("auto", config[:class_groups]["overflow"].first["overflow"].first)
Expand Down

0 comments on commit 1836845

Please sign in to comment.