Skip to content

🏗️🚀:minify the HTML that gets served - #1862

Merged
openinf-commit-queue[bot] merged 1 commit into
livefrom
feat/minify-html
Aug 26, 2026
Merged

🏗️🚀:minify the HTML that gets served#1862
openinf-commit-queue[bot] merged 1 commit into
livefrom
feat/minify-html

Conversation

@DerekNonGeneric

@DerekNonGeneric DerekNonGeneric commented Aug 25, 2026

Copy link
Copy Markdown
Member

Every page ships with the indentation the templates are written in.
This runs the output through html-minifier-terser, in the build that
publishes only.

bytes
before 321,039
after 251,307
saved 69,732 (21.7%)

Gzipped, which is what actually crosses the wire:

bytes
before 31,239
after 27,589
saved 3,650 (11.7%)

_site stays readable in a diff and in the browser while developing —
the same split the stylesheet already makes between main.css and
main.min.css.

Two settings are load-bearing

caseSensitive is not optional here. Six SVG elements are inlined into
the home page alone, and SVG attributes are camelCase: viewBox,
preserveAspectRatio. Lowercasing them leaves attributes the browser
does not act on, and nothing would fail loudly — the mark would just
stop drawing. Verified after the change: viewBox still appears 6
times, viewbox 0.

sortAttributes and sortClassName save nothing by themselves. They
give the compressor longer repeated runs, which is where part of the
gzip figure above comes from.

Checked for the things minification usually breaks

  • SVG attributesviewBox preserved, no lowercased variants
  • JSON-LD — the application/ld+json block still parses as JSON
  • <pre> blocks — content intact on all three pages that have them
  • Attributes — the toggle keeps aria-controls, aria-expanded,
    aria-label, class, id and type; aria-current="page" still
    on the nav links
  • Entities&hellip;, &amp;, &copy; left alone
  • vnunps verify.htmlValidForVNU passes against the minified
    output
  • The site still works — the drawer opens on all seven page types
    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, not undefined, so the
first version of the guard used ?.endsWith and threw on every
partial. It checks the type now.

Refs #1543

Summary by CodeRabbit

  • Performance
    • Production pages now load with minimized HTML for faster delivery.
    • Whitespace, comments, and other unnecessary markup are removed while preserving SVG behavior.
    • Development builds and non-HTML files remain unchanged.

@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploy Preview for gh-pages-openinf ready!

Name Link
🔨 Latest commit 00dd695
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a8e1297d83f760008e0c1e2
😎 Deploy Preview https://deploy-preview-1862--gh-pages-openinf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@socket-security

socket-security Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedhtml-minifier-terser@​7.2.010010010082100

View full report

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
@OpenINFbot

Copy link
Copy Markdown
Member

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ce8bb206-faed-4bd0-b2d4-1eb26966bdf8

📥 Commits

Reviewing files that changed from the base of the PR and between 1cddc7b and 00dd695.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • eleventy.config.mjs
  • package.json

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Eleventy now minifies generated HTML in production builds with html-minifier-terser. The transform skips development builds, non-string content, non-HTML paths, and stylesheet partial outputs.

Changes

Production HTML Minification

Layer / File(s) Summary
Production minification transform
package.json, eleventy.config.mjs
Adds html-minifier-terser and registers a production-only Eleventy transform. The transform minifies eligible HTML and preserves case-sensitive SVG attributes while leaving other outputs unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 00dd6

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
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: minifying the generated HTML served in production.
Docstring Coverage ✅ Passed 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…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/minify-html

Comment @coderabbitai help to get the list of available commands.

@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Aug 26, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit 546bf43 into live Aug 26, 2026
17 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Aug 26, 2026
@DerekNonGeneric
DerekNonGeneric deleted the feat/minify-html branch August 26, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants