File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 3
3
declare (strict_types=1 );
4
4
5
5
return [
6
+ /*
7
+ |--------------------------------------------------------------------------
8
+ | Cache Store
9
+ |--------------------------------------------------------------------------
10
+ |
11
+ | Tailwind Merge uses Laravel's cache system to store the merged classes.
12
+ | Here you can customize the cache store that Tailwind Merge uses.
13
+ */
14
+
15
+ 'cache_store ' => env ('TAILWIND_MERGE_CACHE_STORE ' ),
16
+
6
17
/*
7
18
|--------------------------------------------------------------------------
8
19
| Prefix
Original file line number Diff line number Diff line change 4
4
5
5
namespace TailwindMerge \Laravel ;
6
6
7
+ use Illuminate \Support \Facades \Cache ;
7
8
use Illuminate \Support \ServiceProvider as BaseServiceProvider ;
8
9
use Illuminate \View \Compilers \BladeCompiler ;
9
10
use Illuminate \View \ComponentAttributeBag ;
11
+ use Psr \SimpleCache \CacheInterface ;
10
12
use TailwindMerge \Contracts \TailwindMergeContract ;
11
13
use TailwindMerge \TailwindMerge ;
12
14
13
15
class TailwindMergeServiceProvider extends BaseServiceProvider
14
16
{
15
17
public function register (): void
16
18
{
17
- $ this ->app ->singleton (TailwindMergeContract::class, static fn (): TailwindMerge => TailwindMerge::factory ()
19
+ $ this ->app ->singleton (TailwindMergeContract::class, fn (): TailwindMerge => TailwindMerge::factory ()
18
20
->withConfiguration (config ('tailwind-merge ' , []))
19
- ->withCache (app ( ' cache ' )-> store ()) // @phpstan-ignore-line
21
+ ->withCache ($ this -> getCacheStore ())
20
22
->make ());
21
23
22
24
$ this ->app ->alias (TailwindMergeContract::class, 'tailwind-merge ' );
@@ -90,4 +92,12 @@ public function provides(): array
90
92
'tailwind-merge ' ,
91
93
];
92
94
}
95
+
96
+ protected function getCacheStore (): CacheInterface
97
+ {
98
+ /** @var string|null $storage */
99
+ $ storage = config ('tailwind-merge.cache.store ' );
100
+
101
+ return Cache::store ($ storage );
102
+ }
93
103
}
Original file line number Diff line number Diff line change 12
12
->expect ('TailwindMerge\Laravel\TailwindMergeServiceProvider ' )
13
13
->toOnlyUse ([
14
14
'Illuminate\Contracts\Support\DeferrableProvider ' ,
15
+ 'Illuminate\Support\Facades\Cache ' ,
15
16
'Illuminate\Support\ServiceProvider ' ,
16
17
'Illuminate\View\Compilers\BladeCompiler ' ,
17
18
'Illuminate\View\ComponentAttributeBag ' ,
19
+ 'Psr\SimpleCache\CacheInterface ' ,
18
20
'TailwindMerge ' ,
19
21
20
22
// helpers...
You can’t perform that action at this time.
0 commit comments