Keep the application's stylesheets off the scaffold page too
Plan step 38 review: /material/shell still passed the whole configured Vite list, so it loaded Tailwind and all.css a second time beside the showcase bundle. Both frames now take ShowcaseAssetController::scripts(): every entry but a stylesheet, by the same extensions Laravel's Vite treats as CSS (not only .css), and skip @vite() when nothing is left, since a list of stylesheets alone would read a build manifest for nothing. A test renders the overview, a section, a layout page and the shell against a hot file. The frame's header said the rail collapses from `lg`; it is `expanded` (840px). The config comment is shorter and true. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Opus 5
parent
7abcc7c5f5
commit
2f649983fa
@@ -104,6 +104,25 @@ class ShowcaseAssetController
|
||||
return route('livewire-material.stylesheet', ['hash' => self::hash(self::build())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The application's Vite entries (`livewire-material.showcase.vite`) the showcase's own pages
|
||||
* pass to `@vite()`: every one but a stylesheet — a path Laravel's Vite itself treats as CSS —
|
||||
* since those pages draw their CSS from `url()`'s bundle alone. An application's CSS entry
|
||||
* would load Tailwind for nothing, or the package's stylesheets a second time. Empty when the
|
||||
* list names only stylesheets, and then the page skips `@vite()` altogether (it would read a
|
||||
* build manifest for nothing). A JavaScript entry that imports a stylesheet itself still
|
||||
* brings it: Vite links a chunk's own CSS.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public static function scripts(): array
|
||||
{
|
||||
return array_values(array_filter(
|
||||
(array) config('livewire-material.showcase.vite', []),
|
||||
fn (mixed $entry): bool => is_string($entry) && preg_match('/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?[^\.]*)?$/', $entry) !== 1,
|
||||
));
|
||||
}
|
||||
|
||||
protected static function build(): string
|
||||
{
|
||||
$files = [self::path('all.css'), self::path('showcase.css')];
|
||||
|
||||
Reference in New Issue
Block a user