An MkDocs plugin to minify HTML and/or JS files prior to being written to disk.
HTML minification is done using htmlmin.
JS minification is done using jsmin.
Install the plugin using pip:
pip install mkdocs-minify-plugin
Activate the plugin in
Note: If you have no
pluginsentry in your config file yet, you'll likely also want to add the
searchplugin. MkDocs enables it by default if there is no
pluginsentry set, but now you have to enable it explicitly.
minify_html: Sets whether HTML files should be minified. Defaults to
minify_js: Sets whether JS files should be minified. Defaults to
false. If set to
true, you must specificy the JS to be minified files using
js_files: List of JS files to be minified. The plugin will generate minified versions of these files and save them as
.min.jsin the output directory.
Note: When using
minify_js, you don't have to modify the
mkdocs.ymlfile. The plugins automatically takes care of that.
More information about plugins in the MkDocs documentation.
More information about templates here.
More information about blocks here.