🏗️🚀:minify the HTML that gets served - #1862
Conversation
✅ Deploy Preview for gh-pages-openinf ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Every page ships with the indentation the templates are written in. Across the twenty pages that is 70KB of whitespace and comments, a fifth of the HTML, and 3.6KB once gzipped -- which is the figure that counts, since what serves the site compresses it. Only the build that publishes, so `_site` stays readable in a diff and in the browser while developing. The stylesheet already splits that way, between `main.css` and `main.min.css`. Two settings are load-bearing rather than incidental. Attribute names stay case-sensitive: SVG carries `viewBox` and `preserveAspectRatio`, and a lowercased attribute is one the browser does not act on. Attributes and class names are sorted, which saves nothing by itself and gives the compressor longer runs to find. Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is> Assisted-by: Claude-Code:claude-opus-5 Refs: #1543
da695a9 to
00dd695
Compare
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughEleventy now minifies generated HTML in production builds with ChangesProduction HTML Minification
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds build-time HTML minification without any supplied evidence of a current correctness, security, availability, or deployment risk; it is merge-ready after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Eleventy
participant MinificationTransform
participant HTMLMinifierTerser
Eleventy->>MinificationTransform: pass generated output
MinificationTransform->>HTMLMinifierTerser: minify eligible production HTML
HTMLMinifierTerser-->>MinificationTransform: return minified HTML
MinificationTransform-->>Eleventy: return transformed output
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Every page ships with the indentation the templates are written in.
This runs the output through
html-minifier-terser, in the build thatpublishes only.
Gzipped, which is what actually crosses the wire:
_sitestays readable in a diff and in the browser while developing —the same split the stylesheet already makes between
main.cssandmain.min.css.Two settings are load-bearing
caseSensitiveis not optional here. Six SVG elements are inlined intothe home page alone, and SVG attributes are camelCase:
viewBox,preserveAspectRatio. Lowercasing them leaves attributes the browserdoes not act on, and nothing would fail loudly — the mark would just
stop drawing. Verified after the change:
viewBoxstill appears 6times,
viewbox0.sortAttributesandsortClassNamesave nothing by themselves. Theygive the compressor longer repeated runs, which is where part of the
gzip figure above comes from.
Checked for the things minification usually breaks
viewBoxpreserved, no lowercased variantsapplication/ld+jsonblock still parses as JSON<pre>blocks — content intact on all three pages that have themaria-controls,aria-expanded,aria-label,class,idandtype;aria-current="page"stillon the nav links
…,&,©left alonenps verify.htmlValidForVNUpasses against the minifiedoutput
in WebKit, Escape and the backdrop close it, focus moves and returns,
right-to-left still mirrors, tap targets still 50x48 and 319x56
One trap worth recording
Sass partials have
outputPath === false, notundefined, so thefirst version of the guard used
?.endsWithand threw on everypartial. It checks the type now.
Refs #1543
Summary by CodeRabbit