vite-php-setup
vite-php-setup copied to clipboard
Modify cssUrls function in helper
I was using your helpers, thanks btw, and I realized that it didn't collect css file of the imported from main entry
function cssUrls(string $entry): array
{
$urls = [];
$manifest = getManifest();
if (!empty($manifest[$entry]['css'])) {
foreach ($manifest[$entry]['css'] as $file) {
$urls[] = '/build/' . $file;
}
}
if (!empty($manifest[$entry]['imports'])) {
foreach ($manifest[$entry]['imports'] as $imports) {
if (!empty($manifest[$imports]['css'])) {
foreach ($manifest[$imports]['css'] as $cssFile) {
$urls[] = '/build/' . $cssFile;
}
}
}
}
return $urls;
}