Skip to content

Commit

Permalink
Fix unnecessary creation of stylesheet link markup in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Fürhoff committed Jan 7, 2025
1 parent 507e5e0 commit d809671
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ViteManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function getStyles(string ...$entries): array
{
// Server. Return standalone entries;
if ($this->useServer()) {
$stylesheets = array_merge($entries);
$stylesheets = array_filter($entries, fn($entry) => $this->isStylesheet($entry));

return $this->prefixFiles($stylesheets);
}
Expand Down Expand Up @@ -466,4 +466,9 @@ protected function useServer(): bool
{
return $this->devEnabled;
}

private function isStylesheet($filename): bool
{
return in_array(pathinfo($filename, PATHINFO_EXTENSION), ['css', 'less', 'scss']);
}
}

0 comments on commit d809671

Please sign in to comment.