vite-php-setup icon indicating copy to clipboard operation
vite-php-setup copied to clipboard

Modify cssUrls function in helper

Open rationalthinker1 opened this issue 3 years ago • 0 comments

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

rationalthinker1 avatar Feb 13 '22 09:02 rationalthinker1