Put Tailwind's preflight below the material layers in the Workbench

Plan step 36. A component rewritten without Tailwind keeps its padding,
margins and borders in material.components, and Tailwind's preflight
(* { padding: 0; margin: 0; border: 0 solid }) in its base layer, named
after material, undid every one of them. The Workbench now names theme and
base before importing the foundation, so the preflight — the same reset
foundation/reset.css carries — sits below the package, while Tailwind's
components and utilities stay above it and a caller's utility still wins.

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-14 13:59:30 +02:00
co-authored by Claude Opus 5
parent 6be9f35c98
commit d7653aa6d0
2 changed files with 16 additions and 5 deletions
+6 -2
View File
@@ -412,14 +412,18 @@ it('draws the interaction classes as the utilities the Tailwind components still
->and(stylesheetBlock($interaction, '.md-touch-target'))->toContain('min-width: var(--md-sys-measurement-space600);');
});
it('declares the material layers in the Workbench before Tailwind\'s', function () {
it('declares the material layers in the Workbench above Tailwind\'s preflight and below its utilities', function () {
$app = stylesheetWithoutComments(File::get(__DIR__.'/../../workbench/resources/css/app.css'));
$foundation = strpos($app, "@import '../../../resources/css/foundation.css';");
$tailwind = strpos($app, "@import 'tailwindcss'");
$components = strpos($app, "@import '../../../resources/css/tailwind.css';");
expect($foundation)->toBeInt()
// Tailwind's theme and preflight are named before the material layers, below them: the
// preflight is the foundation's own reset, and above `material` it would zero every
// component's padding. Its components and utilities come after, above the package.
expect(stylesheetItems($app)[0]['statement'] ?? null)->toBe('@layer theme, base;')
->and($foundation)->toBeInt()
->and($tailwind)->toBeGreaterThan($foundation)
->and($components)->toBeGreaterThan($tailwind)
// material.css would declare the tokens a second time.
+10 -3
View File
@@ -1,7 +1,14 @@
/* The Workbench builds the package as an application would, with explicit sources so the plans
in docs/ are not scanned for class names. The foundation comes before Tailwind, so the
`material` layers are declared first and sit below Tailwind's; tailwind.css brings the
components still written for Tailwind, without declaring the tokens a second time. */
in docs/ are not scanned for class names.
Tailwind's theme and base layers are named first, then the foundation's `material` layers, then
Tailwind's components and utilities: a caller's utility still outranks every package rule, and
Tailwind's preflight sits below the package. Its preflight is the reset the foundation already
carries rule for rule (foundation/reset.css), and above `material` its `* { padding: 0 }` would
undo the padding and margins of every component rewritten without Tailwind. tailwind.css brings
the components still written for Tailwind, without declaring the tokens a second time. */
@layer theme, base;
@import '../../../resources/css/foundation.css';
@import '../../../resources/css/layout.css';
@import '../../../resources/css/components.css';