minify-html/nodejs/index.d.ts

34 lines
1.4 KiB
TypeScript
Raw Normal View History

/**
2022-06-21 09:03:35 -04:00
* Minifies a string containing HTML code.
*
2022-06-21 09:03:35 -04:00
* @param src - Source HTML code
* @param cfg - Configurable minifier settings to use
* @returns Minified HTML code
*/
2022-06-21 09:03:35 -04:00
export function minify (src: Buffer, cfg: {
/** Do not minify DOCTYPEs. Minified DOCTYPEs may not be spec compliant. */
do_not_minify_doctype?: boolean,
/** Ensure all unquoted attribute values in the output do not contain any characters prohibited by the WHATWG specification. */
ensure_spec_compliant_unquoted_attribute_values?: boolean;
2021-08-07 06:02:20 -04:00
/** Do not omit closing tags when possible. */
keep_closing_tags?: boolean;
/** Do not omit `<html>` and `<head>` opening tags when they don't have attributes. */
keep_html_and_head_opening_tags?: boolean;
/** Keep spaces between attributes when possible to conform to HTML standards. */
keep_spaces_between_attributes?: boolean;
/** Keep all comments. */
keep_comments?: boolean;
/**
2022-06-21 03:29:12 -04:00
* If enabled, content in `<script>` tags with a JS or no [MIME type](https://mimesniff.spec.whatwg.org/#javascript-mime-type) will be minified using [minify-js](https://github.com/wilsonzlin/minify-js).
*/
minify_js?: boolean;
2021-01-07 08:26:02 -05:00
/**
2022-06-21 03:29:12 -04:00
* If enabled, CSS in `<style>` tags and `style` attributes will be minified.
2021-01-07 08:26:02 -05:00
*/
minify_css?: boolean;
2021-08-07 06:02:20 -04:00
/** Remove all bangs. */
remove_bangs?: boolean;
/** Remove all processing_instructions. */
remove_processing_instructions?: boolean;
2022-06-21 09:03:35 -04:00
}): Buffer;