GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(html): allow object for optimization.minimize to support HTML minification options by aryanraj45 · Pull Request #21537 · webpack/webpack

Conversation

@aryanraj45

@aryanraj45 aryanraj45 commented Jul 28, 2026 •
edited by cursor Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

Extends HTML minification to optionally strip quotes from attributes and collapse boolean attributes when optimization.minimize is configured as an options object.

This builds on the safe minify groundwork introduced in #21491. While #21491 establishes the HTML/CSS minimizers, this PR updates the Webpack schema to allow optimization.minimize to be an object instead of just a boolean. This enables passing specific options down to the minimizers, and specifically implements removeAttributeQuotes and collapseBooleanAttributes in the HTML printer (lib/html/syntax.js).

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes, added ConfigTestCases for html minimize covering the new schema object shape and attribute output.

Does this PR introduce a breaking change?

No.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

The new optimization.minimize object options (removeAttributeQuotes and collapseBooleanAttributes) should be documented.

Use of AI

YES


Note

Medium Risk
Opt-in HTML output changes can affect layout if whitespace is relied on outside excluded elements; wiring is limited to production minify defaults but touches emitted .html assets.

Overview
optimization.minimize can be an object (still accepts a boolean). An object turns minimization on and passes per-minimizer options beyond the always-safe transforms; the first supported knob is html.collapseWhitespace, typed as OptimizationMinimizeHtml in the public declarations and JSON schema.

When HTML minification runs, lib/config/defaults.js spreads optimization.minimize.html into the built-in HTML minifier options (alongside the existing CSS environment). htmlMinify forwards collapseWhitespace into the HTML SourceProcessor, which implements optional text-node collapsing via a new collapseWs helper: runs of HTML whitespace become a single space, never removed entirely, skipped under pre / textarea / listing ancestors, and skipped when text contains < so template-like content stays on the passthrough path.

Reviewed by Cursor Bugbot for commit 7606cb0. Bugbot is set up for automated code reviews on this repo. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@changeset-bot

changeset-bot Bot commented Jul 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7606cb0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aryanraj45
aryanraj45 force-pushed the feat/html-minimize-options branch from 48f9510 to 6d7c6f5 Compare July 30, 2026 21:51
@aryanraj45
aryanraj45 marked this pull request as ready for review July 30, 2026 21:51
cursor[bot]
cursor Bot reviewed Jul 30, 2026
View reviewed changes
Comment thread lib/html/syntax.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Jul 30, 2026
View reviewed changes
Comment thread lib/html/syntax.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Jul 30, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f9b60f3. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/html/syntax.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aryanraj45
feat: accept an object for optimization.minimize
7606cb0
Carries what a minimizer may do beyond the transforms that always apply,
starting with html.collapseWhitespace: each run of whitespace in text
becomes a single space, never nothing — removing it joins two inline
elements that render apart. Skipped under pre/textarea/listing and for
text holding a '<', which stays on the source-passthrough path.
@aryanraj45
aryanraj45 force-pushed the feat/html-minimize-options branch from f9b60f3 to 7606cb0 Compare August 7, 2026 15:05
@aryanraj45

aryanraj45 commented Aug 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@alexander-akait optimization.minimizenow also takes an object, so there's a place for things a minimizer may do beyond the always-safe transforms. First one ishtml.collapseWhitespace`:

optimization: { minimize: { html: { collapseWhitespace: true } } }

A run of whitespace becomes a single space, never dropped — removing it would join two inline elements that render apart. Skipped under pre/textarea/listing, and for text with a < so <%= x %> isn't escaped. true/false unchanged
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait alexander-akait mentioned this pull request Aug 10, 2026
feat: configure or exclude each asset type's minifier via optimization.minimize #21663
Merged
@alexander-akait alexander-akait closed this in #21663 Aug 10, 2026
This was referenced Aug 27, 2026
optimization.minimize: true crashes in 5.110.0 when a plugin sets it on already-normalized options #21844
Closed
fix: accept the optimization.minimize true shorthand after normalization #21845
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@cursor cursor[bot] cursor[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@aryanraj45
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.