Skip to content

Modify cssUrls function in helper #9

@rationalthinker1

Description

@rationalthinker1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions