Nuglify
module Nuglify| Assembly | Nacara.Plugin.Assets.Nuglify |
| Attributes | [<RequireQualifiedAccess>] |
Minifies what a site writes: its HTML, its JavaScript, its CSS.
One registration per format, so ask for the ones you want:
Site.create "My library"
|> Nuglify.minifyHtml
|> Nuglify.minifyJs
|> LightningCss.register // the CSS, from a tool that also compiles it
Each touches its own format: minifying the HTML leaves style and script as it found them. Nothing is downloaded, and a file that cannot be parsed is written as it was and reported as a warning.
Functions and values
css (options: NuglifyCssOptions) (content: string) : Result<string,string>
css (options: NuglifyCssOptions) (content: string) : Result<string,string>Minify one stylesheet, or say why it could not be.
This minifies and stops there. LightningCss also compiles - nesting flattened, color-mix() computed, prefixes added for the browsers you name - so a site written in modern CSS wants that one instead. Register one or the other, never both.
| Parameter | |
|---|---|
options | What the site asked for. |
content | The stylesheet as it would have been written. |
cssDefaults: NuglifyCssOptionscssKeepLicenceComments (value: bool) (options: NuglifyCssOptions) : NuglifyCssOptions
cssKeepLicenceComments (value: bool) (options: NuglifyCssOptions) : NuglifyCssOptionsKeep /*! … */ comments, where a licence lives.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
cssMinifyWhileWatching (value: bool) (options: NuglifyCssOptions) : NuglifyCssOptions
cssMinifyWhileWatching (value: bool) (options: NuglifyCssOptions) : NuglifyCssOptionsMinify while watching too.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
html (options: NuglifyHtmlOptions) (content: string) : Result<string,string>
html (options: NuglifyHtmlOptions) (content: string) : Result<string,string>Minify one document, or say why it could not be.
| Parameter | |
|---|---|
options | What the site asked for. |
content | The document as it would have been written. |
htmlCollapseWhitespace (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptions
htmlCollapseWhitespace (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptionsCollapse runs of whitespace between elements.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
htmlDefaults: NuglifyHtmlOptionshtmlKeepOneSpace (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptions
htmlKeepOneSpace (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptionsLeave one space where a run of whitespace was, so nothing the reader sees moves.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
htmlMinifyWhileWatching (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptions
htmlMinifyWhileWatching (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptionsMinify while watching too.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
htmlRemoveAttributeQuotes (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptions
htmlRemoveAttributeQuotes (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptionsRemove quotes from attribute values that do not need them.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
htmlRemoveComments (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptions
htmlRemoveComments (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptionsRemove HTML comments.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
htmlRemoveOptionalTags (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptions
htmlRemoveOptionalTags (value: bool) (options: NuglifyHtmlOptions) : NuglifyHtmlOptionsRemove end tags HTML5 says are optional - </body>, </li>.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
js (options: NuglifyJsOptions) (content: string) : Result<string,string>
js (options: NuglifyJsOptions) (content: string) : Result<string,string>Minify one script, or say why it could not be.
| Parameter | |
|---|---|
options | What the site asked for. |
content | The script as it would have been written. |
jsDefaults: NuglifyJsOptionsjsKeepLicenceComments (value: bool) (options: NuglifyJsOptions) : NuglifyJsOptions
jsKeepLicenceComments (value: bool) (options: NuglifyJsOptions) : NuglifyJsOptionsKeep comments marked as important, the /*! … */ kind.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
jsMinifyWhileWatching (value: bool) (options: NuglifyJsOptions) : NuglifyJsOptions
jsMinifyWhileWatching (value: bool) (options: NuglifyJsOptions) : NuglifyJsOptionsMinify while watching too.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
jsShortenNames (value: bool) (options: NuglifyJsOptions) : NuglifyJsOptions
jsShortenNames (value: bool) (options: NuglifyJsOptions) : NuglifyJsOptionsShorten the names of local variables.
| Parameter | |
|---|---|
value | The value to use. |
options | The options so far. |
minifyCssWith (configure: NuglifyCssOptions -> NuglifyCssOptions) (site: Site) : Site
minifyCssWith (configure: NuglifyCssOptions -> NuglifyCssOptions) (site: Site) : SiteMinify the site's CSS, configured.
| Parameter | |
|---|---|
configure | Given the defaults, the options to use. |
site | The site you are describing. |
minifyHtmlWith (configure: NuglifyHtmlOptions -> NuglifyHtmlOptions) (site: Site) : Site
minifyHtmlWith (configure: NuglifyHtmlOptions -> NuglifyHtmlOptions) (site: Site) : SiteMinify the site's HTML, configured.
| Parameter | |
|---|---|
configure | Given the defaults, the options to use. |
site | The site you are describing. |
minifyJsWith (configure: NuglifyJsOptions -> NuglifyJsOptions) (site: Site) : Site
minifyJsWith (configure: NuglifyJsOptions -> NuglifyJsOptions) (site: Site) : SiteMinify the site's JavaScript, configured.
| Parameter | |
|---|---|
configure | Given the defaults, the options to use. |
site | The site you are describing. |