Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/helpers/ManifestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ public static function extractManifestTags(string $path, bool $asyncCss = true,
}
// Include any CSS tags
$cssFiles = [];
$isCssEntry = str_contains(self::$manifest[$manifestKey]['file'] ?? '', '.css');

self::extractCssFiles(self::$manifest, $manifestKey, $cssFiles);
foreach ($cssFiles as $cssFile) {
$tags[$cssFile] = [
Expand All @@ -174,6 +176,11 @@ public static function extractManifestTags(string $path, bool $asyncCss = true,
], $asyncCssOptions, $cssTagAttrs)
];
}

// Remove duplicate script entry since this is CSS-like entry
if ($isCssOutputFile) {
unset($tags[$manifestKey]);
}
}

return $tags;
Expand Down Expand Up @@ -219,8 +226,14 @@ protected static function extractCssFiles(array $manifest, string $manifestKey,
if (!$entry) {
return [];
}
$entryFileName = $entry['file'] ?? '';
$cssFiles = array_merge($cssFiles, $entry['css'] ?? []);
$imports = $entry['imports'] ?? [];

if (str_contains($entryFileName, '.css')) {
$cssFiles[] = $entryFileName;
}

foreach ($imports as $import) {
self::extractCssFiles($manifest, $import, $cssFiles);
}
Expand Down