ProperDocs and MkDocs plugin that minifies the built HTML pages, including inline CSS and JS, with minify-html.
MkDocs is no longer maintained, and its last release, 1.6.1, came out in August 2024. MkDocs 2.0, now in development, has no plugin system, so this plugin will not run on it. ProperDocs continues MkDocs 1.x. It reads mkdocs.yml and runs existing plugins without changes, this one included. This plugin still supports MkDocs 1.x as well.
Install:
uv add --dev mkdocs-minify-html-plugin
# or
pip install -U mkdocs-minify-html-pluginActivate in properdocs.yml or mkdocs.yml:
plugins:
- search
- minify_htmlThe options are the fields of minify-html's Cfg. The defaults aim for the smallest output that stays spec-compliant:
plugins:
- search
- minify_html:
allow_noncompliant_unquoted_attribute_values: false
allow_optimal_entities: false
allow_removing_spaces_between_attributes: false
keep_closing_tags: false
keep_comments: false
keep_html_and_head_opening_tags: false
keep_input_type_text_attr: true
keep_ssi_comments: false
minify_css: true
minify_doctype: false
minify_js: true
preserve_brace_template_syntax: false
preserve_chevron_percent_template_syntax: false
remove_bangs: false
remove_processing_instructions: false