-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Issue: The minifier preserves whichever entity encoding was in the input, rather than normalizing to a canonical form.
Example:
const opts = { collapseWhitespace: true, removeComments: true };
await minify('<a>&</a>', opts); // Output: <a>&</a>
await minify('<a>&</a>', opts); // Output: <a>&</a>
Both & and & represent the same character (&), but the minifier produces different outputs.
Expected behavior: A minifier should produce identical output for semantically identical input. Since & and & are equivalent, the output should be normalized to one form.
Implementing the behavior in this issue would not improve the test score results on the homepage. But they improved the compressed result. Similar to existing features that are motivated by this: https://github.com/terser/html-minifier-terser?tab=readme-ov-file#sorting-attributes--style-classes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels