Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/astro_compress/src/options/html.ts>default

🗜️ AstroJS compression utilities. Compress CSS, HTML, JavaScript and more.
Go to Latest
interface default
import { type default } from "https://deno.land/x/astro_compress@v1.0.2/src/options/html.ts";

Index Signatures

[key: string]: any

Properties

optional
caseSensitive: Boolean

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

optional
collapseBooleanAttributes: Boolean

Omit attribute values from boolean attributes.

optional
collapseInlineTagWhitespace: Boolean

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

optional
collapseWhitespace: Boolean

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

optional
conservativeCollapse: Boolean

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

optional
continueOnParseError: Boolean

Handle parse errors instead of aborting.

optional
customAttrAssign: RegExp[]

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

optional
customAttrCollapse: RegExp

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

optional
customAttrSurround: RegExp[]

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

optional
customEventAttributes: RegExp[]

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

optional
decodeEntities: Boolean

Use direct Unicode characters whenever possible.

optional
html5: Boolean

Parse input according to HTML5 specifications.

optional
ignoreCustomComments: RegExp[]

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

optional
ignoreCustomFragments: RegExp[]

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

optional
includeAutoGeneratedTags: Boolean

Insert tags generated by HTML parser.

optional
keepClosingSlash: Boolean

Keep the trailing slash on singleton elements.

optional
maxLineLength: Number | null

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

optional
minifyCSS: Boolean | Object | ((unnamed 0: { text: string; type: string; }) => void)

Minify CSS in style elements and style attributes (uses clean-css).

optional
minifyJS: Boolean | Object | ((unnamed 0: { text: string; inline: string; }) => void)

Minify JavaScript in script elements and event attributes (uses Terser).

optional
minifyURLs:
| Boolean
| String
| Object
| ((unnamed 0: { text: string; }) => void)

Minify URLs in various attributes (uses relateurl).

optional
noNewlinesBeforeTagClose: Boolean

Never add a newline before a tag that closes an element.

optional
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

optional
preventAttributesEscaping: Boolean

Prevents the escaping of the values of attributes.

optional
processConditionalComments: Boolean

Process contents of conditional comments through minifier.

optional
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.).

optional
quoteCharacter: String

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

optional
removeAttributeQuotes: Boolean

Remove quotes around attributes when possible.

optional
removeComments: Boolean

Strip HTML comments.

optional
removeEmptyAttributes: Boolean | ((unnamed 0: { attrName: string; tag: string; }) => void)

Remove all attributes with whitespace-only values.

optional
removeEmptyElements: Boolean

Remove all elements with empty contents.

optional
removeOptionalTags: Boolean

Remove optional tags.

optional
removeRedundantAttributes: Boolean

Remove attributes when value matches default.

optional
removeScriptTypeAttributes: Boolean

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

optional
removeStyleLinkTypeAttributes: Boolean

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

optional
removeTagWhitespace: Boolean

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

optional
sortAttributes: Boolean

Sort attributes by frequency.

optional
sortClassName: Boolean

Sort style classes by frequency.

optional
trimCustomFragments: Boolean

Trim white space around ignoreCustomFragments

optional
useShortDoctype: Boolean

Replaces the doctype with the short (HTML5) doctype.