From d7653aa6d00cba477d47c8e31a0d5a793edb5a01 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Mon, 14 Sep 2026 13:59:30 +0200 Subject: [PATCH] Put Tailwind's preflight below the material layers in the Workbench MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- tests/Feature/StylesheetsTest.php | 8 ++++++-- workbench/resources/css/app.css | 13 ++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/Feature/StylesheetsTest.php b/tests/Feature/StylesheetsTest.php index 2d6df214..9e7e4d12 100644 --- a/tests/Feature/StylesheetsTest.php +++ b/tests/Feature/StylesheetsTest.php @@ -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. diff --git a/workbench/resources/css/app.css b/workbench/resources/css/app.css index b0d5c678..08204aee 100644 --- a/workbench/resources/css/app.css +++ b/workbench/resources/css/app.css @@ -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';