Skip to content
A mkdocs plugin to minify the HTML of a page before it is written to disk.
Python Shell
Branch: master
Clone or download
byrnereese Merge pull request #5 from wilhelmer/master
Bugfix: Change extra_javascript entries so they point to the minified files
Latest commit dee3414 May 14, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
mkdocs_minify_plugin Optimized performance May 10, 2019
.gitignore Initial add Dec 19, 2018
LICENSE Update May 10, 2019
requirements.txt Added JS minification, adapted documentation May 10, 2019


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 mkdocs.yml:

  - search
  - minify:
      minify_html: true
      minify_js: true
          - my/javascript/dir/file1.js
          - my/javascript/dir/file2.js

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.


  • minify_html: Sets whether HTML files should be minified. Defaults to false.
  • 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 (see below).
  • js_files: List of JS files to be minified. The plugin will generate minified versions of these files and save them as .min.js in the output directory.

Note: When using minify_js, you don't have to modify the extra_javascript entries in your mkdocs.yml file. The plugins automatically takes care of that.

More information about plugins in the MkDocs documentation.

See Also

More information about templates here.

More information about blocks here.

You can’t perform that action at this time.