From c736c23a57ab29ad4ff757fe4a221359cac56ab5 Mon Sep 17 00:00:00 2001 From: Rias Date: Tue, 16 Jul 2024 13:34:19 +0200 Subject: [PATCH] Include styles as well --- src/LivewireFilepondServiceProvider.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/LivewireFilepondServiceProvider.php b/src/LivewireFilepondServiceProvider.php index 658ce1b..121d4f6 100644 --- a/src/LivewireFilepondServiceProvider.php +++ b/src/LivewireFilepondServiceProvider.php @@ -25,6 +25,10 @@ public function packageBooted(): void return Utils::pretendResponseIsFile(__DIR__.'/../resources/dist/filepond.js'); })->name('livewire-filepond.scripts'); + Route::get('_filepond/styles', function () { + return Utils::pretendResponseIsFile(__DIR__.'/../resources/dist/filepond.css', 'text/css'); + })->name('livewire-filepond.styles'); + Blade::component('livewire-filepond::upload', 'filepond::upload'); Blade::directive('filepondScripts', function () { @@ -33,11 +37,16 @@ public function packageBooted(): void $scripts = []; // Default to dynamic js (served by a Laravel route). - $fullAssetPath = route('livewire-filepond.scripts'); + $fullScriptPath = route('livewire-filepond.scripts'); + $fullStylePath = route('livewire-filepond.styles'); // Use static assets if they have been published if (file_exists(public_path('vendor/livewire-filepond/filepond.js'))) { - $fullAssetPath = asset('/vendor/livewire-filepond/filepond.js'); + $fullScriptPath = asset('/vendor/livewire-filepond/filepond.js'); + } + + if (file_exists(public_path('vendor/livewire-filepond/filepond.css'))) { + $fullStylePath = asset('/vendor/livewire-filepond/filepond.css'); } if (is_file(__DIR__.'/../resources/hot')) { @@ -47,7 +56,8 @@ public function packageBooted(): void $scripts[] = sprintf('', "{$url}/@vite/client"); } else { $scripts[] = << + + HTML; }