update(html-minifier): continueOnParserError and version bump (#45594)

- `continueOnParseError` added:
https://github.com/kangax/html-minifier/pull/1004/files
- version 4 bump (no breaking changes):
https://github.com/kangax/html-minifier/releases/tag/v4.0.0
- maintainer added

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-06-21 10:20:47 +02:00 committed by GitHub
parent 6db8e019b5
commit 8b08f8668b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import * as HTMLMinifier from 'html-minifier';
const minify = HTMLMinifier.minify;
const result = minify('<p title="blah" id="moo">foo</p>', {
removeAttributeQuotes: true
removeAttributeQuotes: true,
continueOnParseError: true,
});
result; // '<p title=blah id=moo>foo</p>'

View File

@ -1,9 +1,9 @@
// Type definitions for html-minifier 3.5
// Type definitions for html-minifier 4.0
// Project: https://github.com/kangax/html-minifier, https://kangax.github.io/html-minifier
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Riku <https://github.com/rikuayanokozy>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as UglifyJS from 'uglify-js';
import * as CleanCSS from 'clean-css';
@ -29,6 +29,11 @@ export interface Options {
// Always collapse to 1 space (never remove it entirely). Must be used in conjunction with collapseWhitespace=true
conservativeCollapse?: boolean;
/**
* Handle parse errors instead of aborting
* @default false
*/
continueOnParseError?: boolean;
// Arrays of regex'es that allow to support custom attribute assign expressions (e.g. '<div flex?="{{mode != cover}}"></div>')
customAttrAssign?: RegExp[];