Most of the options are disabled by default

Hierarchy

  • Options

Properties

caseSensitive?: boolean

Treat attributes in case sensitive manner (useful for custom HTML tags)

Default

false
collapseBooleanAttributes?: boolean

Omit attribute values from boolean attributes

Default

false
collapseInlineTagWhitespace?: boolean

Don't leave any spaces between display:inline; elements when collapsing. Must be used in conjunction with collapseWhitespace=true

Default

false
collapseWhitespace?: boolean

Collapse white space that contributes to text nodes in a document tree

Default

false
conservativeCollapse?: boolean

Always collapse to 1 space (never remove it entirely). Must be used in conjunction with collapseWhitespace=true

Default

false
continueOnParseError?: boolean

Handle parse errors

Default

false
customAttrAssign?: RegExp[]

Arrays of regex'es that allow to support custom attribute assign expressions (e.g. '<div flex?="{{mode != cover}}"></div>')

Default

[]
customAttrCollapse?: RegExp

Regex that specifies custom attribute to strip newlines from (e.g. /ng-class/

customAttrSurround?: RegExp[]

Arrays of regex'es that allow to support custom attribute surround expressions (e.g. <input {{#if value}}checked="checked"{{/if}}>)

Default

[]
customEventAttributes?: RegExp[]

Arrays of regex'es that allow to support custom event attributes for minifyJS (e.g. ng-click)

Default

[/^on[a-z]{3,}$/]
decodeEntities?: boolean

Use direct Unicode characters whenever possible

Default

false
html5?: boolean

Parse input according to HTML5 specifications

Default

true
ignoreCustomComments?: RegExp[]

Array of regex'es that allow to ignore certain comments, when matched

Default

[ /^!/, /^\s*#/ ]
ignoreCustomFragments?: RegExp[]

Array of regex'es that allow to ignore certain fragments, when matched (e.g. <?php ... ?>, {{ ... }}, etc.)

Default

[/<%[\s\S]*?%>/, /<\?[\s\S]\*?\?>/]
includeAutoGeneratedTags?: boolean

Insert tags generated by HTML parser

Default

true
keepClosingSlash?: boolean

Keep the trailing slash on singleton elements

Default

false
maxLineLength?: number

Specify a maximum line length. Compressed output will be split by newlines at valid HTML split-points

minifyCSS?: boolean | object | ((text, type?) => string)

Minify CSS in style elements and style attributes

Type declaration

    • (text, type?): string
    • Parameters

      • text: string
      • Optional type: string

      Returns string

Default

false
minifyJS?: boolean | object | ((text, inline?) => string)

Minify JavaScript in script elements and event attributes

Type declaration

    • (text, inline?): string
    • Parameters

      • text: string
      • Optional inline: boolean

      Returns string

Default

false
minifyURLs?: string | boolean | object | ((text) => string)

Minify URLs in various attributes

Type declaration

    • (text): string
    • Parameters

      • text: string

      Returns string

Default

false
noNewlinesBeforeTagClose?: boolean

Never add a newline before a tag that closes an element

Default

false
preserveLineBreaks?: boolean

Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break. Must be used in conjunction with collapseWhitespace=true

Default

false
preventAttributesEscaping?: boolean

Prevents the escaping of the values of attributes

Default

false
processConditionalComments?: boolean

Process contents of conditional comments through minifier

Default

false
processScripts?: string[]

Array of strings corresponding to types of script elements to process through minifier (e.g. text/ng-template, text/x-handlebars-template, etc.)

Default

[]
quoteCharacter?: string

Type of quote to use for attribute values (' or ")

removeAttributeQuotes?: boolean

Remove quotes around attributes when possible

Default

false
removeComments?: boolean

Strip HTML comments

Default

false
removeEmptyAttributes?: boolean | ((attrName, tag) => boolean)

Remove all attributes with whitespace-only values

Type declaration

    • (attrName, tag): boolean
    • Parameters

      • attrName: string
      • tag: string

      Returns boolean

Default

false
removeEmptyElements?: boolean

Remove all elements with empty contents

Default

false
removeOptionalTags?: boolean

Remove optional tags

Default

false
removeRedundantAttributes?: boolean

Remove attributes when value matches default

Default

false
removeScriptTypeAttributes?: boolean

Remove type="text/javascript" from script tags. Other type attribute values are left intact

Default

false
removeStyleLinkTypeAttributes?: boolean

Remove type="text/css" from style and link tags. Other type attribute values are left intact

Default

false
removeTagWhitespace?: boolean

Remove space between attributes whenever possible. Note that this will result in invalid HTML!

Default

false
sortAttributes?: boolean

Sort attributes by frequency

Default

false
sortClassName?: boolean

Sort style classes by frequency

Default

false
trimCustomFragments?: boolean

Trim white space around ignoreCustomFragments

Default

false
useShortDoctype?: boolean

Replaces the doctype with the short (HTML5) doctype

Default

false

Generated using TypeDoc