
A mkdocs plugin to minify the HTML of a page before it is written to disk.
If you're looking for a way to optimize your static sites built with MkDocs, the mkdocs-minify-plugin is an essential tool that can help you achieve this. This plugin efficiently minifies your HTML, JavaScript, and CSS files before they are saved to disk, ensuring that your deployment is cleaner and your site loads faster. Utilizing popular minification libraries such as htmlmin, jsmin, and csscompressor, the mkdocs-minify-plugin streamlines the doc generation process and enhances performance with minimal effort.
Setting up the plugin is straightforward, requiring just a few lines in your configuration file. Once activated, this plugin gives you control over which files get minified while allowing you to maintain clear organization within your project.
HTML Minification: Reduces the size of your HTML files using the efficient htmlmin library, improving load times for your web pages.
JavaScript Minification: Easily minify JavaScript files with the jsmin tool. Specify which files to minify for a cleaner and lighter web experience.
CSS Minification: Leverage csscompressor to minify your CSS files, ensuring that styles are loaded faster with fewer bytes.
Cache-Safe Options: By setting cache_safe to true, you can append a hash to generated file names, making sure users always get the latest version instead of a cached one.
Support for File Lists: Define lists of JS and CSS files to minify within the configuration, simplifying management and providing control over what gets processed.
Glob Support: Enhance flexibility with support for glob patterns, allowing you to easily target multiple files across directories.
No Extra Config Needed: The plugin manages the inclusion of minified files automatically, meaning you won’t have to edit other parts of your mkdocs.yml file.
Custom Runtime Options: Adjust runtime API options for HTML minification with htmlmin_opts, fine-tuning the process to suit your needs.
