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:
Andreas Reinhold / reini
2026-09-15 06:07:44 +02:00
co-authored by Claude Opus 5
parent 7abcc7c5f5
commit 2f649983fa
5 changed files with 71 additions and 25 deletions
+31
View File
@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\Str;
use NoNameWeb\LivewireMaterial\Http\Controllers\ShowcaseAssetController;
use NoNameWeb\LivewireMaterial\Support\Stylesheets;
@@ -104,3 +105,33 @@ it('mounts none of the showcase asset routes when the showcase is off', function
$this->refreshApplication();
}
});
it('passes Vite the application entries but its stylesheets, on every kind of showcase page', function () {
$hot = sys_get_temp_dir().'/livewire-material-showcase-hot-'.Str::random(8);
file_put_contents($hot, 'http://vite.test');
Vite::useHotFile($hot);
config(['livewire-material.showcase.vite' => ['resources/css/app.css', 'resources/sass/extra.scss', 'resources/js/app.js']]);
try {
expect(ShowcaseAssetController::scripts())->toBe(['resources/js/app.js']);
foreach (['/material', '/material/progress', '/material/layout/feed', '/material/shell'] as $page) {
$this->get($page)
->assertOk()
->assertSee('http://vite.test/resources/js/app.js', false)
->assertDontSee('http://vite.test/resources/css/app.css', false)
->assertDontSee('http://vite.test/resources/sass/extra.scss', false)
->assertSee(ShowcaseAssetController::url(), false);
}
// A list of stylesheets alone leaves @vite() out, rather than reading a manifest for nothing.
config(['livewire-material.showcase.vite' => ['resources/css/app.css']]);
expect(ShowcaseAssetController::scripts())->toBe([]);
$this->get('/material/progress')->assertOk()->assertDontSee('http://vite.test', false);
} finally {
unlink($hot);
}
});