Skip to content

feat: add minifyWhitespace override option#1158

Open
zalishchuk wants to merge 3 commits intoparcel-bundler:masterfrom
zalishchuk:feat/minify-whitespace-override
Open

feat: add minifyWhitespace override option#1158
zalishchuk wants to merge 3 commits intoparcel-bundler:masterfrom
zalishchuk:feat/minify-whitespace-override

Conversation

@zalishchuk
Copy link

Added a new minifyWhitespace option (JS/NAPI) and matching CLI flags (--minify-whitespace / --no-minify-whitespace) so users can control output whitespace/newlines separately from semantic minification.

This is mainly to fix the confusing case where minify: false would still "beautify" the output (add spaces/newlines) even if the input was already compact.

Behavior:

  • If minifyWhitespace is omitted, formatting still follows minify like before (old behavior preserved).
  • If minifyWhitespace is provided, behavior is decoupled:
    • minify controls semantic optimizations
    • minifyWhitespace controls serializer whitespace/newlines

Examples:

  • minify: false, minifyWhitespace: true -> no semantic optimizations + compact output
  • minify: true, minifyWhitespace: false -> semantic optimizations + pretty output

This stays non-breaking for existing JS/CLI users.

@zalishchuk zalishchuk marked this pull request as draft February 22, 2026 04:26
@zalishchuk zalishchuk marked this pull request as ready for review February 22, 2026 21:54
});

assert.equal(res.code.toString(), '.a{color:red}.a{color:#00f}');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps adding some tests for at-rules and CSS functions would be beneficial.

Copy link
Author

Choose a reason for hiding this comment

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

Done in 0686196

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work

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