Skip to content

NuglifyHtmlOptions

type NuglifyHtmlOptions =
    {
        CollapseWhitespace: bool
        KeepOneSpace: bool
        RemoveComments: bool
        RemoveAttributeQuotes: bool
        RemoveOptionalTags: bool
        MinifyWhileWatching: bool
    }
AssemblyNacara.Plugin.Assets.Nuglify

Options for minifying HTML.

Fields

CollapseWhitespace: bool

Collapse runs of whitespace between elements.

The whole risk of minifying HTML lives here: a newline between two inline elements is a space the browser draws. KeepOneSpace is what makes collapsing safe, and turning that off is how words run together.

KeepOneSpace: bool

Leave one space where a run of whitespace was, so nothing the reader sees moves.

RemoveComments: bool

Remove HTML comments.

RemoveAttributeQuotes: bool

Remove quotes from attribute values that do not need them.

RemoveOptionalTags: bool

Remove end tags HTML5 says are optional - </body>, </li>.

Off by default. It is valid, and it saves a few bytes a page, but plenty of tools look for </body> to insert something - Nacara's own dev server does - and a page without one is a surprise waiting for whoever meets it next.

MinifyWhileWatching: bool

Minify while watching too.