Files
livewire-material/workbench/app/Providers/WorkbenchServiceProvider.php
T
Andreas Reinhold / reiniandClaude Opus 5 3854f4321c Build the Workbench's package CSS apart from Tailwind
Plan step 37 review. @tailwindcss/vite inlines the imports of an entry
that uses Tailwind without Vite's skipDuplicates, so with all.css beside
@import 'tailwindcss' every shared component stylesheet repeated later in
the cascade (231 repeated rules; button.css's hover and disabled rules
thirteen times), and every browser test ran against an order no
application gets. workbench/resources/css/package.css now holds all.css
and the scheme in an entry Tailwind never touches, and app.css keeps
Tailwind for the showcase's classes. The built package CSS repeats no
rule, and the Workbench's CSS shrinks from 559 to 406 KB.

Both entries open with the same layer statement, properties first,
because Tailwind hoists that layer to the top of its output; the order
is the one the single entry had, whichever the page links first. The
showcase's Vite config, vite.config.js and the error page test's probe
manifest name the new entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
2026-09-15 03:12:44 +02:00

48 lines
1.9 KiB
PHP

<?php
namespace Workbench\App\Providers;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\ServiceProvider;
use function Orchestra\Testbench\workbench_path;
class WorkbenchServiceProvider extends ServiceProvider
{
/**
* Point the showcase at the Workbench's own Vite entries and dev server.
*
* Set in boot() rather than register(): config merging is shallow, so a nested key
* written before the package merges its defaults would replace the whole
* `showcase` array.
*/
public function boot(): void
{
config(['livewire-material.showcase.vite' => [
// The package's CSS apart from Tailwind's, so Vite deduplicates its imports (package.css).
'workbench/resources/css/package.css',
'workbench/resources/css/app.css',
'workbench/resources/js/app.js',
]]);
// Three colour profiles, generated into workbench/resources/css/material-scheme.css with
// `vendor/bin/testbench material:scheme --output=workbench/resources/css/material-scheme.css`.
// Baseline is the package's own default, so the stylesheet draws it as before; the showcase
// offers the others. Tests start without profiles and point at the file when they need it.
config([
'livewire-material.profiles' => [
'baseline' => ['label' => 'Baseline', 'seed' => '#6750a4', 'variant' => 'tonal-spot'],
'teal' => ['label' => 'Teal', 'seed' => '#00897b', 'variant' => 'vibrant'],
'rose' => ['label' => 'Rose', 'seed' => '#c2185b', 'variant' => 'vibrant'],
],
'livewire-material.profile' => 'baseline',
]);
if (! $this->app->runningUnitTests()) {
config(['livewire-material.scheme' => workbench_path('resources/css/material-scheme.json')]);
}
Vite::useHotFile(workbench_path('public/hot'));
}
}