This repository was archived by the owner on Jan 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 2929 \Jonassiewertsen \Livewire \Synthesizers \EntrySynthesizer::class,
3030 ],
3131 ],
32+
33+ /*
34+ |--------------------------------------------------------------------------
35+ | Replacers
36+ |--------------------------------------------------------------------------
37+ |
38+ | Define the replacers that will be used when static caching is enabled
39+ | to dynamically replace content within the response.
40+ |
41+ */
42+
43+ 'replacers ' => [
44+ \Jonassiewertsen \Livewire \Replacers \AssetsReplacer::class,
45+ ],
3246];
Original file line number Diff line number Diff line change 11<?php
22
3- namespace Jonassiewertsen \Livewire ;
3+ namespace Jonassiewertsen \Livewire \ Replacers ;
44
55use Illuminate \Http \Response ;
66use Illuminate \Support \Str ;
99use Livewire \Mechanisms \FrontendAssets \FrontendAssets ;
1010use Statamic \StaticCaching \Replacer ;
1111
12- class LivewireReplacer implements Replacer
12+ class AssetsReplacer implements Replacer
1313{
1414 public function prepareResponseToCache (Response $ responseToBeCached , Response $ initialResponse )
1515 {
Original file line number Diff line number Diff line change 33namespace Jonassiewertsen \Livewire ;
44
55use Livewire \Livewire ;
6+ use Statamic \StaticCaching \Replacer ;
67use Statamic \Providers \AddonServiceProvider ;
78
89class ServiceProvider extends AddonServiceProvider
@@ -23,10 +24,19 @@ public function bootAddon(): void
2324 ], 'statamic-livewire ' );
2425 }
2526
27+ $ this ->bootReplacers ();
2628 $ this ->bootSyntesizers ();
2729 }
2830
29- protected function bootSyntesizers ()
31+ protected function bootReplacers (): void
32+ {
33+ config ()->set ('statamic.static_caching.replacers ' , array_merge (
34+ config ('statamic.static_caching.replacers ' ),
35+ config ('statamic-livewire.replacers ' )
36+ ));
37+ }
38+
39+ protected function bootSyntesizers (): void
3040 {
3141 if (! config ('statamic-livewire.synthesizers.enabled ' , false )) {
3242 return ;
You can’t perform that action at this time.
0 commit comments