Skip to main content
Module

x/ter/deps.ts>MinifyOpts

A tiny wiki-style site builder with Zettelkasten flavor.
Go to Latest
interface MinifyOpts
import { type MinifyOpts } from "https://deno.land/x/ter@0.6.1/deps.ts";

Most of the options are disabled by default

Properties

optional
caseSensitive: boolean | undefined

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

optional
collapseBooleanAttributes: boolean | undefined

Omit attribute values from boolean attributes

optional
collapseInlineTagWhitespace: boolean | undefined

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

optional
collapseWhitespace: boolean | undefined

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

optional
conservativeCollapse: boolean | undefined

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

optional
continueOnParseError: boolean | undefined

Handle parse errors

optional
customAttrAssign: RegExp[] | undefined

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

optional
customAttrCollapse: RegExp | undefined

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

optional
customAttrSurround: RegExp[] | undefined

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

optional
customEventAttributes: RegExp[] | undefined

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

optional
decodeEntities: boolean | undefined

Use direct Unicode characters whenever possible

optional
html5: boolean | undefined

Parse input according to HTML5 specifications

optional
ignoreCustomComments: RegExp[] | undefined

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

optional
ignoreCustomFragments: RegExp[] | undefined

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

optional
includeAutoGeneratedTags: boolean | undefined

Insert tags generated by HTML parser

optional
keepClosingSlash: boolean | undefined

Keep the trailing slash on singleton elements

optional
maxLineLength: number | undefined

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

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

Minify CSS in style elements and style attributes

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

Minify JavaScript in script elements and event attributes

optional
minifyURLs:
| boolean
| string
| object
| ((text: string) => string)
| undefined

Minify URLs in various attributes

optional
noNewlinesBeforeTagClose: boolean | undefined

Never add a newline before a tag that closes an element

optional
preserveLineBreaks: boolean | undefined

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 | undefined

Prevents the escaping of the values of attributes

optional
processConditionalComments: boolean | undefined

Process contents of conditional comments through minifier

optional
processScripts: string[] | undefined

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 | undefined

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

optional
removeAttributeQuotes: boolean | undefined

Remove quotes around attributes when possible

optional
removeComments: boolean | undefined

Strip HTML comments

optional
removeEmptyAttributes: boolean | ((attrName: string, tag: string) => boolean) | undefined

Remove all attributes with whitespace-only values

optional
removeEmptyElements: boolean | undefined

Remove all elements with empty contents

optional
removeOptionalTags: boolean | undefined

Remove optional tags

optional
removeRedundantAttributes: boolean | undefined

Remove attributes when value matches default

optional
removeScriptTypeAttributes: boolean | undefined

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

optional
removeStyleLinkTypeAttributes: boolean | undefined

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

optional
removeTagWhitespace: boolean | undefined

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

optional
sortAttributes: boolean | undefined

Sort attributes by frequency

optional
sortClassName: boolean | undefined

Sort style classes by frequency

optional
trimCustomFragments: boolean | undefined

Trim white space around ignoreCustomFragments

optional
useShortDoctype: boolean | undefined

Replaces the doctype with the short (HTML5) doctype