Compile the showcase's views with the showcase off
tests / lint (push) Successful in 1m6s
tests / feature (8.4) (push) Successful in 1m18s
tests / feature (8.5) (push) Successful in 1m17s
tests / browser (chrome, chromium) (push) Successful in 3m27s
tests / browser (firefox, firefox) (push) Successful in 4m57s
tests / browser (safari, webkit) (push) Successful in 5m29s
tests / lint (push) Successful in 1m6s
tests / feature (8.4) (push) Successful in 1m18s
tests / feature (8.5) (push) Successful in 1m17s
tests / browser (chrome, chromium) (push) Successful in 3m27s
tests / browser (firefox, firefox) (push) Successful in 4m57s
tests / browser (safari, webkit) (push) Successful in 5m29s
php artisan view:cache compiles every view in the package's namespace, the showcase's pages included, but the showcase:: component prefix was only registered while the showcase was enabled. In production, where it is off, view:cache failed with "Unable to locate a class or view for component [showcase::example]" and an application caching its views on start would not boot. The prefix is now always registered; the routes still are not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
co-authored by
Claude Opus 5
parent
8afe9bac6a
commit
db179e6b4e
@@ -175,12 +175,14 @@ class LivewireMaterialServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function registerShowcase(): void
|
protected function registerShowcase(): void
|
||||||
{
|
{
|
||||||
|
// Registered even with the showcase off: `php artisan view:cache` compiles every view in the
|
||||||
|
// package's namespace, the showcase's pages included, and <x-showcase::…> must resolve there.
|
||||||
|
Blade::anonymousComponentPath(__DIR__.'/../resources/views/showcase/components', 'showcase');
|
||||||
|
|
||||||
if (! config('livewire-material.showcase.enabled')) {
|
if (! config('livewire-material.showcase.enabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Blade::anonymousComponentPath(__DIR__.'/../resources/views/showcase/components', 'showcase');
|
|
||||||
|
|
||||||
if ($this->app->routesAreCached()) {
|
if ($this->app->routesAreCached()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,20 @@ it('does not mount the showcase when disabled', function () {
|
|||||||
$this->get('/material')->assertNotFound();
|
$this->get('/material')->assertNotFound();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('compiles every package view with the showcase off, as view:cache does in production', function () {
|
||||||
|
rebootWithShowcase(false);
|
||||||
|
|
||||||
|
$compiled = sys_get_temp_dir().'/livewire-material-view-cache-'.uniqid();
|
||||||
|
config(['view.compiled' => $compiled]);
|
||||||
|
File::ensureDirectoryExists($compiled);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->artisan('view:cache')->assertSuccessful();
|
||||||
|
} finally {
|
||||||
|
File::deleteDirectory($compiled);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it('serves a symbol for the icon search', function () {
|
it('serves a symbol for the icon search', function () {
|
||||||
$this->get('/material/symbols/filled/favorite.svg')
|
$this->get('/material/symbols/filled/favorite.svg')
|
||||||
->assertOk()
|
->assertOk()
|
||||||
|
|||||||
Reference in New Issue
Block a user