Repository navigation
3.6.0
Added
removeOptionalTags: { removeStartTags: false }to omit end tags while keeping explicit start tags.normalizeDoctype: 'html5'to normalize short HTML5 doctypes without changing document mode.
Changed
- Enable optional attribute quote removal, conservative end-tag omission, and HTML5 doctype normalization in
safeandampSafe. These presets preserve browser-parsed HTML behavior, not source serialization or XHTML/XML compatibility. - Improve CSS minification performance through job deduplication, lazy processor initialization, and batching of inline styles with the default cssnano preset [#400].
- Skip character-reference decoding checks for attributes without ampersands [#462].
Fixed
- Preserve significant whitespace and word separators around inline, custom, and non-rendering elements; keep whitespace-only elements [#463], [#465].
- Preserve custom-element and AMP attribute values, meaningful empty attributes, enumerated states, and repeated
pingURLs. - Preserve script execution order and stylesheet cascade/CSP boundaries when merging scripts and styles.
- Preserve event-handler semantics and escaping, respect script types and external sources, and prevent script breakouts.
- Preserve JSON numeric precision, negative zero, and duplicate keys; limit JSON minification to script elements.
- Preserve shared SVG IDs and definitions, and skip unsafe optimization of embedded HTML [#464].
- Preserve URL destinations,
srcsetcandidates, meta refresh targets, andjavascript:execution semantics. - Prevent character-reference decoding and comment/element/tag removal from introducing markup or changing literal text. Preserve template and conditional-comment parsing boundaries.
- Preserve Astro hydration comments in safe mode [#273] and fix stateful comment regex matching.
- Preserve required XML quotes and namespace attributes, duplicate attribute order, and context-sensitive optional tags across repeated minification.
- Preserve used CSS selectors and definitions during unused-CSS removal; isolate custom cssnano configurations across supported versions.
Documentation and testing
- Split module documentation into individual files; add HTML DOM equivalence checks, expand fuzz coverage, and test cssnano 7–9 compatibility in CI.
Upgrade notes
Default output changes. To retain the previous quote, tag, and doctype settings, pass { removeAttributeQuotes: false, removeOptionalTags: false, normalizeDoctype: false }. Correctness fixes may still require snapshot updates.