From 150858485d725c560e948ac5f1dd50423c0a325d Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 21 Dec 2023 10:59:15 +0100 Subject: [PATCH] include custom.css from config.json if preset correctly Signed-off-by: Michael Kaufmann --- lib/functions.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 1777adc5..a2f0a2aa 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -112,9 +112,14 @@ function vite($basehref, array $filenames): string $assetDirectory = '/templates/' . $matches[1] . '/build/'; $viteManifest = dirname(__DIR__) . $assetDirectory . '/manifest.json'; $manifest = json_decode(file_get_contents($viteManifest), true); - $links[] = $basehref . ltrim($assetDirectory, '/') . $manifest[$filename]['file']; + if (!empty($manifest[$filename]['file'])) { + $links[] = $basehref . ltrim($assetDirectory, '/') . $manifest[$filename]['file']; + } else { + // additional asset from config.json that was not prebuilt on release (e.g. custom.css) + $links[] = $filename; + } } else { - $links = $filenames; + $links[] = $filename; } }