{"id":4631,"library":"mkdocs-minify-plugin","title":"MkDocs Minify Plugin","description":"An MkDocs plugin designed to minify HTML, JavaScript, and CSS files before they are written to disk. It leverages `htmlmin2` for HTML, `jsmin` for JavaScript, and `csscompressor` for CSS minification. The project is actively maintained, with regular updates addressing compatibility and feature enhancements.","status":"active","version":"0.8.0","language":"en","source_language":"en","source_url":"https://github.com/byrnereese/mkdocs-minify-plugin","tags":["MkDocs","minification","HTML","CSS","JavaScript","plugin"],"install":[{"cmd":"pip install mkdocs-minify-plugin","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency for any MkDocs plugin; requires >=1.4.1 for compatibility.","package":"mkdocs","optional":false},{"reason":"Used for minifying HTML content; requires >=0.1.13.","package":"htmlmin2","optional":false},{"reason":"Used for minifying JavaScript files; requires >=3.0.1.","package":"jsmin","optional":false},{"reason":"Used for minifying CSS files; requires >=0.9.5.","package":"csscompressor","optional":false},{"reason":"Requires Python version >=3.8.","package":"python","optional":false}],"imports":[],"quickstart":{"code":"plugins:\n  - search # Often needed, see warnings\n  - minify:\n      minify_html: true\n      minify_js: true\n      minify_css: true\n      htmlmin_opts:\n        remove_comments: true\n      cache_safe: true\n      js_files:\n        - '**/*.js'\n      css_files:\n        - '**/*.css'","lang":"yaml","description":"Add the `minify` plugin to your `mkdocs.yml` file under the `plugins` section. Remember to also explicitly add the `search` plugin if you don't have other plugins defined, as MkDocs disables default plugins when a `plugins` section is present. Configure `minify_html`, `minify_js`, `minify_css`, and specify `js_files`/`css_files` for minification."},"warnings":[{"fix":"Upgrade mkdocs-minify-plugin to version 0.7.0 or higher: `pip install --upgrade mkdocs-minify-plugin`.","message":"MkDocs 1.5 compatibility was introduced in plugin version 0.7.0. If you are using MkDocs 1.5 or newer, you must use mkdocs-minify-plugin version 0.7.0 or later to ensure compatibility and avoid potential build errors.","severity":"breaking","affected_versions":"<0.7.0"},{"fix":"Ensure your `plugins` section includes `- search` if desired: `plugins: \\n  - search \\n  - minify: ...`.","message":"When you explicitly define a `plugins` section in your `mkdocs.yml`, MkDocs no longer implicitly enables the built-in `search` plugin. To retain search functionality alongside `minify`, you must explicitly list `search` in your `plugins` section.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Provide explicit `js_files` and `css_files` lists when enabling JS/CSS minification, for example: `js_files: ['**/*.js']`.","message":"Enabling `minify_js: true` or `minify_css: true` alone is not sufficient. You must also specify the JavaScript and CSS files to be minified using the `js_files` and `css_files` options (which support glob patterns).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to `mkdocs-minify-plugin` version 0.6.2 or newer to improve JavaScript minification compatibility: `pip install --upgrade mkdocs-minify-plugin`.","message":"Versions prior to 0.6.2 might experience issues with minifying modern ES6 JavaScript due to `jsmin` not always being called with the appropriate `quote_chars` option.","severity":"deprecated","affected_versions":"<0.6.2"},{"fix":"Upgrade to `mkdocs-minify-plugin` version 0.6.3 or newer to resolve the `htmlmin` deprecation warning: `pip install --upgrade mkdocs-minify-plugin`.","message":"Versions prior to 0.6.3 may produce a `DeprecationWarning` related to an older `htmlmin` dependency during the build process.","severity":"deprecated","affected_versions":"<0.6.3"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}