Skip to content

Commit 16e2c71

Browse files
authored
Fix ordering of stylesheets (#43962)
In order to allow CSS overrides from within the application's stylesheet, the application's stylesheet has to be included *after* any vendor stylesheet.
1 parent d44c345 commit 16e2c71

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/Illuminate/Foundation/Vite.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,19 @@ public function __invoke($entrypoints, $buildDirectory = null)
213213
foreach ($entrypoints as $entrypoint) {
214214
$chunk = $this->chunk($manifest, $entrypoint);
215215

216+
foreach ($chunk['imports'] ?? [] as $import) {
217+
foreach ($manifest[$import]['css'] ?? [] as $css) {
218+
$partialManifest = Collection::make($manifest)->where('file', $css);
219+
220+
$tags->push($this->makeTagForChunk(
221+
$partialManifest->keys()->first(),
222+
asset("{$buildDirectory}/{$css}"),
223+
$partialManifest->first(),
224+
$manifest
225+
));
226+
}
227+
}
228+
216229
$tags->push($this->makeTagForChunk(
217230
$entrypoint,
218231
asset("{$buildDirectory}/{$chunk['file']}"),
@@ -230,19 +243,6 @@ public function __invoke($entrypoints, $buildDirectory = null)
230243
$manifest
231244
));
232245
}
233-
234-
foreach ($chunk['imports'] ?? [] as $import) {
235-
foreach ($manifest[$import]['css'] ?? [] as $css) {
236-
$partialManifest = Collection::make($manifest)->where('file', $css);
237-
238-
$tags->push($this->makeTagForChunk(
239-
$partialManifest->keys()->first(),
240-
asset("{$buildDirectory}/{$css}"),
241-
$partialManifest->first(),
242-
$manifest
243-
));
244-
}
245-
}
246246
}
247247

248248
[$stylesheets, $scripts] = $tags->partition(fn ($tag) => str_starts_with($tag, '<link'));

0 commit comments

Comments
 (0)