Take Tailwind out of the package, and its detection out of the guard
tests / feature (8.4) (push) Successful in 2m0s
tests / feature (8.5) (push) Successful in 2m0s
tests / browser (chrome, chromium) (push) Failing after 8m3s
tests / browser (firefox, firefox) (push) Failing after 12m58s
tests / browser (safari, webkit) (push) Failing after 13m8s
tests / feature (8.4) (push) Successful in 2m0s
tests / feature (8.5) (push) Successful in 2m0s
tests / browser (chrome, chromium) (push) Failing after 8m3s
tests / browser (firefox, firefox) (push) Failing after 12m58s
tests / browser (safari, webkit) (push) Failing after 13m8s
Tailwind left the stack in 2.0.0, but the package still carried about 330 mentions of it. What the guard's Tailwind detection protected — a class that compiles to nothing — is now protected by a check that does not care where a dead class came from. DesignGuard: about 500 lines of Tailwind tables, scales, palettes and "2.0.0 replacement" hints give way to one check — a class a view or PHP file writes that neither the application's stylesheets nor the package's own declare. It catches a utility of any framework, a typo and a class whose rules were deleted alike, so it also found two classes ReStride draws nothing with. A stylesheet has to be in reach for it: the `.css` files among the scanned paths, or what the `missingStylesheets()` entry imports. The class reader no longer mistakes an array index for a class list (`$block['base']`), and it reads the array a class helper is given, where it read nothing before. The package's own three Tailwind self-guards go with it. Only their one unique check stays, as a test of its own: every `matchMedia` width in resources/js is an M3 breakpoint. The pagination views are `material.blade.php` and `simple-material.blade.php`; only Laravel's and Livewire's default theme names ever made them `tailwind`. The provider sets `Paginator`'s default views and switches `livewire.pagination_theme` to `material` when it is still Livewire's own default, so no application can forget the config; a theme an application chose, and a component's own `$paginationTheme` or `paginationView()`, still win. The rest is prose: the layer-order guidance for an application that still builds Tailwind, the Tailwind wording in the README, the Boost guidelines and the development skill, and about 25 "this used to be a Tailwind utility" comments, along with every "plan step NN" pointer into a gitignored folder. The reset keeps its credit, and NOTICE now carries it too. Feature suite 1159 passed, Chrome browser suite 299 passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
247c596c3a
commit
fb7007c976
@@ -34,27 +34,6 @@ it('resolves the files an entry imports, transitively, without bundling any cont
|
||||
);
|
||||
});
|
||||
|
||||
it('resolves past what an application entry imports and only a Vite build resolves, without throwing', function () {
|
||||
$dir = sys_get_temp_dir().'/livewire-material-resolved-'.Str::random(8);
|
||||
File::makeDirectory($dir);
|
||||
File::put($dir.'/theme.css', '.theme {}');
|
||||
File::put($dir.'/app.css', implode("\n", [
|
||||
"@import 'tailwindcss';",
|
||||
"@import url('https://fonts.googleapis.com/css2?family=Roboto');",
|
||||
"@import './theme.css' layer(app);",
|
||||
"@import './missing.css';",
|
||||
"@import '".stylesheetsBundlePath('components/icon.css')."';",
|
||||
]));
|
||||
|
||||
try {
|
||||
$files = Stylesheets::resolvedFiles([$dir.'/app.css']);
|
||||
} finally {
|
||||
File::deleteDirectory($dir);
|
||||
}
|
||||
|
||||
expect($files)->toBe([realpath(sys_get_temp_dir()).'/'.basename($dir).'/app.css', realpath(sys_get_temp_dir()).'/'.basename($dir).'/theme.css']);
|
||||
});
|
||||
|
||||
/**
|
||||
* Deduplication keeps a file at its first position, so an override that ties a rule it imports on
|
||||
* specificity (the navigation rail's header FAB over fab.css was one) still wins only while every
|
||||
@@ -170,11 +149,12 @@ function stylesheetsBundleLeafRules(string $css): array
|
||||
*
|
||||
* The built CSS is minified, so this compares rules rather than files: no innermost rule may
|
||||
* appear twice under the same at-rules. A build that inlined every occurrence of a shared
|
||||
* stylesheet repeats hundreds of them (the Workbench's entry did while it shared one file with
|
||||
* `@tailwindcss/vite`: button.css's hover and disabled rules thirteen times), while a file's plain
|
||||
* root rule alone is no evidence — the minifier folds identical copies of that one together. In
|
||||
* the application entry, button.css must also keep its first position: before split-button.css,
|
||||
* the first file that imports it, not at the end where the application named it again.
|
||||
* stylesheet repeats hundreds of them (the Workbench's entry did while `@tailwindcss/vite` was
|
||||
* still in its graph, inlining imports itself ahead of Vite's own postcss-import: button.css's
|
||||
* hover and disabled rules thirteen times), while a file's plain root rule alone is no evidence —
|
||||
* the minifier folds identical copies of that one together. In the application entry, button.css
|
||||
* must also keep its first position: before split-button.css, the first file that imports it, not
|
||||
* at the end where the application named it again.
|
||||
*/
|
||||
it('lands every rule once, at its first position, in a real Vite build of all.css and of an application entry', function () {
|
||||
$node = config('livewire-material.node', 'node');
|
||||
|
||||
Reference in New Issue
Block a user