{"id":24043,"library":"mkdocs-minify-html-plugin","title":"mkdocs-minify-html-plugin","description":"MkDocs plugin that minifies HTML, JS, and CSS output using the blisteringly fast minify-html Rust-based minifier. Current version 0.3.10, released June 2024. Active development with semver.","status":"active","version":"0.3.10","language":"python","source_language":"en","source_url":"https://github.com/thatmattlove/mkdocs-minify-html-plugin","tags":["mkdocs","minification","html","css","javascript","static-site-generator","rust"],"install":[{"cmd":"pip install mkdocs-minify-html-plugin","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Core MkDocs is required; plugin runs as a MkDocs build step.","package":"mkdocs","optional":false},{"reason":"Rust-based minifier engine; pulled automatically as a Python wheel.","package":"minify-html","optional":false}],"imports":[{"note":"The package uses underscores in the import path, matching the name without hyphens. Old attempts to import dash-based names fail.","wrong":"import minify_html_plugin","symbol":"MinifyHTMLPlugin","correct":"from mkdocs_minify_html_plugin import MinifyHTMLPlugin"}],"quickstart":{"code":"# mkdocs.yml\nplugins:\n  - search\n  - minify-html:\n      minify_js: true\n      minify_css: true\n      htmlmin_opts:\n        remove_comments: true\n        collapse_whitespace: true","lang":"yaml","description":"Enable the plugin in your MkDocs configuration. The plugin automatically minifies all HTML, JS, and CSS output during build."},"warnings":[{"fix":"Update your mkdocs.yml: replace 'js: true' with 'minify_js: true', same for css.","message":"From version 0.3.0, the option names changed: 'minify_js' and 'minify_css' replaced 'js' and 'css'. The old names silently fail.","severity":"breaking","affected_versions":"<0.3.0"},{"fix":"Order: start with 'search', then add 'minify-html'.","message":"The plugin must be listed after 'search' in the plugins list to ensure minification runs after search index generation.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate 'htmlmin_opts.remove_comments' to 'remove_comments: true' (once 0.4.0 lands). For now, both work.","message":"The 'htmlmin_opts' sub-options are deprecated as of 0.4.0 (unreleased). Use top-level options instead.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Add 'minify_inline_css: true' and 'minify_inline_js: true' to your plugin config.","message":"The plugin does not minify inline CSS/JS inside <style> and <script> tags by default. Set 'minify_inline_css' and 'minify_inline_js' if needed.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from mkdocs_minify_html_plugin import MinifyHTMLPlugin","cause":"Wrong import: importing the module instead of the class or using hyphens.","error":"AttributeError: module 'mkdocs_minify_html_plugin' has no attribute 'MinifyHTMLPlugin'"},{"fix":"Install the correct package: pip install mkdocs-minify-html-plugin","cause":"Misspelled package name: installing 'minify-html' instead of 'mkdocs-minify-html-plugin'.","error":"ModuleNotFoundError: No module named 'minify_html'"},{"fix":"Replace 'js' with 'minify_js' and 'css' with 'minify_css' in mkdocs.yml.","cause":"Using old option names from pre-0.3.0.","error":"Config error: Unrecognised configuration key: 'js'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}