From 4cf0997712707ea23689d50f8acd5863eb295fc4 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Tue, 15 Sep 2026 09:34:27 +0200 Subject: [PATCH] Keep all.css under a gzip size budget, no Node required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Measured the way the showcase and the error page's fallback actually serve it — Stylesheets::bundle() in PHP, then PHP's own gzencode() — so CI holds the line with no Node build. Currently 106,838 bytes gzipped; the budget is 120,000, about 10% of headroom for organic growth before the failure message points a maintainer at what grew. Plan step 42 (Phase F), Part A. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- tests/Feature/StylesheetsTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Feature/StylesheetsTest.php b/tests/Feature/StylesheetsTest.php index 82e51dc4..ab086f55 100644 --- a/tests/Feature/StylesheetsTest.php +++ b/tests/Feature/StylesheetsTest.php @@ -3,6 +3,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\File; use NoNameWeb\LivewireMaterial\Support\Layout; +use NoNameWeb\LivewireMaterial\Support\Stylesheets; use NoNameWeb\LivewireMaterial\Testing\DesignGuard; /** @@ -772,3 +773,19 @@ it('shapes showcase.css like a package stylesheet, with its documented unlayered } } }); + +it('keeps all.css under a gzip size budget, measured through Stylesheets::bundle()', function () { + // 106,838 bytes gzipped today (2026-09-15), rounded up by about 10% to a number CI can hold + // to without Node: PHP's own gzencode() on the same bytes Stylesheets::bundle() serves the + // showcase and the error page's fallback. A little organic growth should not retrigger this + // on every commit; a real jump means look at what grew since the budget was last raised. + $budget = 120_000; + + $gzipped = strlen((string) gzencode(Stylesheets::bundle([stylesheetPath('all.css')]), 9)); + + expect($gzipped)->toBeLessThanOrEqual($budget, sprintf( + 'all.css now gzips to %s bytes, over the %s-byte budget — see what grew, and raise the budget deliberately if it should have.', + number_format($gzipped), + number_format($budget), + )); +});