From cde0cb7a61eba18bd97cc8dc64d3607f7869fd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20F=C3=BCrhoff?= <12294151+imagoiq@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:17:32 +0100 Subject: [PATCH] Support CSS standalon in dev --- src/ViteManifest.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ViteManifest.php b/src/ViteManifest.php index b70b1a1..059f06c 100644 --- a/src/ViteManifest.php +++ b/src/ViteManifest.php @@ -155,20 +155,24 @@ public function getScripts(string ...$entries): array /** * Fetches and returns all style files for the specified entry points, - * unless dev server is enabled, in which case no style are required. + * unless dev server is enabled, in which case only standalone entries are returned. * * @param string ...$entries * - * @throws JsonException If manifest can't be read + * @return string[] Path to each style files * @throws EntrypointNotFoundException If an entry point is not found in the manifest. * - * @return string[] Path to each style files + * @throws JsonException If manifest can't be read */ public function getStyles(string ...$entries): array { - // Server. Returns nothing. + $files = []; + + // Server. Return standalone entries + server; if ($this->useServer()) { - return []; + $stylesheets = array_merge(['@vite/client'], $entries); + + return $this->prefixFiles($stylesheets); } // Default behavior