include custom.css from config.json if preset correctly

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2023-12-21 10:59:15 +01:00
parent e7810e2066
commit 150858485d
No known key found for this signature in database
GPG Key ID: C121F97338D7A352

View File

@ -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;
}
}