Minify HTML
Minify the HTML code of your pages.
Options See on deno.land
- extensions object
The list of extensions this plugin applies to.
Default:[ ".html" ]
- options object
Default options for minify-html library
- do_not_minify_doctype boolean
Do not minify DOCTYPEs. Minified DOCTYPEs may not be spec compliant.
Default:true
- ensure_spec_compliant_unquoted_attribute_values boolean
Ensure all unquoted attribute values in the output do not contain any characters prohibited by the WHATWG specification.
Default:true
- keep_closing_tags boolean
Do not omit closing tags when possible.
Default:false
- keep_html_and_head_opening_tags boolean
Do not omit
Default:<html>
and<head>
opening tags when they don't have attributes.false
- keep_spaces_between_attributes boolean
Keep spaces between attributes when possible to conform to HTML standards.
Default:false
- keep_comments boolean
Keep all comments.
Default:false
- minify_js boolean
If enabled, content in
Default:<script>
tags with a JS or no MIME type will be minified using minify-js.true
- minify_css boolean
If enabled, CSS in
Default:<style>
tags andstyle
attributes will be minified.true
- remove_bangs boolean
Remove all bangs.
Default:false
- remove_processing_instructions boolean
Remove all processing_instructions.
Default:false
Description
The MinifyHTML
plugin minifies the HTML code of your pages using the minify-html minifier. It can also minify CSS and JavaScript code.
Installation
Import this plugin in your _config.ts
file to use it:
import lume from "lume/mod.ts";
import minifyHTML from "lume/plugins/minify_html.ts";
const site = lume();
site.use(minifyHTML(/* Options */));
export default site;
Configuration
This plugin accepts a configuration object. The available options are:
extensions
: Array with the extensions of the files that will be minified. By default it is[".html"]
, but you can include also.css
and.js
to minify these files.options
: The available options forminify-html
. See the documentation for more info.