mkdocs-minify-plugin


Namemkdocs-minify-plugin JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttps://github.com/byrnereese/mkdocs-minify-plugin
SummaryAn MkDocs plugin to minify HTML, JS or CSS files prior to being written to disk
upload_time2024-01-29 16:11:32
maintainer
docs_urlNone
authorByrne Reese, Lars Wilhelmer
requires_python>=3.8
licenseMIT
keywords mkdocs minify publishing documentation html css
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mkdocs-minify-plugin

[![PyPI - Python Version][python-image]][pypi-link]

An MkDocs plugin to minify HTML, JS or CSS files prior to being written to disk.

HTML minification is done using [htmlmin2](https://github.com/wilhelmer/htmlmin).

JS minification is done using [jsmin](https://github.com/tikitu/jsmin/).

CSS minification is done using [csscompressor](https://github.com/sprymix/csscompressor).

## Setup

Install the plugin using pip:

```bash
pip install mkdocs-minify-plugin
```

Activate the plugin in `mkdocs.yml`:

```yaml
plugins:
  - search
  - minify:
      minify_html: true
      minify_js: true
      minify_css: true
      htmlmin_opts:
          remove_comments: true
      cache_safe: true
      js_files:
          - my/javascript/dir/file1.js
          - my/javascript/dir/file2.js
      css_files:
          - my/css/dir/file1.css
          - my/css/dir/file2.css
```

> **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.

## Options

- `minify_html`:
  - Defaults to `False`.
  - Sets whether HTML files should be minified.
- `minify_js`:
  - Defaults to `False`.
  - Sets whether JS files should be minified.<br>
    If set to `True`, you must specify the JS to be minified files using `js_files` (see below).
- `minify_css`:
  - Defaults to `False`.
  - Sets whether CSS files should be minified.<br>
    If set to `True`, you must specify the CSS to be minified files using `css_files` (see below).
- `htmlmin_opts`:
  - Defaults to `None`.
  - Sets runtime htmlmin API options using the [config parameters of htmlmin](https://htmlmin.readthedocs.io/en/latest/reference.html#main-functions)
- `cache_safe`:
  - Defaults to `False`.
  - Sets whether a hash should be added to the JS and CSS file names. This ensures that the browser always loads the latest version of the files instead of loading them from the cache.<br>
    If set to `True`, you must specify the files using `js_files` or `css_files` (see below).
- `js_files`:
  - Defaults to `None`.
  - List of JS files to be minified.<br>
    The plugin will generate minified versions of these files and save them as `.min.js` in the output directory.
- `css_files`:
  - Defaults to `None`.
  - List of CSS files to be minified.<br>
    The plugin will generate minified versions of these files and save them as `.min.css` in the output directory.

> **Note:** When using `minify_js` or `minify_css`, you don't have to modify the `extra_javascript` or `extra_css` entries
in your `mkdocs.yml` file. The plugins automatically takes care of that.
Both `minify_js` and `minify_css` support the use of **globs** (e.g. `**/*.css`).

[pypi-link]: https://pypi.python.org/pypi/mkdocs-minify-plugin/
[python-image]: https://img.shields.io/pypi/pyversions/mkdocs-minify-plugin?logo=python&logoColor=aaaaaa&labelColor=333333

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/byrnereese/mkdocs-minify-plugin",
    "name": "mkdocs-minify-plugin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mkdocs minify publishing documentation html css",
    "author": "Byrne Reese, Lars Wilhelmer",
    "author_email": "byrne@majordojo.com",
    "download_url": "https://files.pythonhosted.org/packages/52/67/fe4b77e7a8ae7628392e28b14122588beaf6078b53eb91c7ed000fd158ac/mkdocs-minify-plugin-0.8.0.tar.gz",
    "platform": null,
    "description": "# mkdocs-minify-plugin\n\n[![PyPI - Python Version][python-image]][pypi-link]\n\nAn MkDocs plugin to minify HTML, JS or CSS files prior to being written to disk.\n\nHTML minification is done using [htmlmin2](https://github.com/wilhelmer/htmlmin).\n\nJS minification is done using [jsmin](https://github.com/tikitu/jsmin/).\n\nCSS minification is done using [csscompressor](https://github.com/sprymix/csscompressor).\n\n## Setup\n\nInstall the plugin using pip:\n\n```bash\npip install mkdocs-minify-plugin\n```\n\nActivate the plugin in `mkdocs.yml`:\n\n```yaml\nplugins:\n  - search\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          - my/javascript/dir/file1.js\n          - my/javascript/dir/file2.js\n      css_files:\n          - my/css/dir/file1.css\n          - my/css/dir/file2.css\n```\n\n> **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.\n\n## Options\n\n- `minify_html`:\n  - Defaults to `False`.\n  - Sets whether HTML files should be minified.\n- `minify_js`:\n  - Defaults to `False`.\n  - Sets whether JS files should be minified.<br>\n    If set to `True`, you must specify the JS to be minified files using `js_files` (see below).\n- `minify_css`:\n  - Defaults to `False`.\n  - Sets whether CSS files should be minified.<br>\n    If set to `True`, you must specify the CSS to be minified files using `css_files` (see below).\n- `htmlmin_opts`:\n  - Defaults to `None`.\n  - Sets runtime htmlmin API options using the [config parameters of htmlmin](https://htmlmin.readthedocs.io/en/latest/reference.html#main-functions)\n- `cache_safe`:\n  - Defaults to `False`.\n  - Sets whether a hash should be added to the JS and CSS file names. This ensures that the browser always loads the latest version of the files instead of loading them from the cache.<br>\n    If set to `True`, you must specify the files using `js_files` or `css_files` (see below).\n- `js_files`:\n  - Defaults to `None`.\n  - List of JS files to be minified.<br>\n    The plugin will generate minified versions of these files and save them as `.min.js` in the output directory.\n- `css_files`:\n  - Defaults to `None`.\n  - List of CSS files to be minified.<br>\n    The plugin will generate minified versions of these files and save them as `.min.css` in the output directory.\n\n> **Note:** When using `minify_js` or `minify_css`, you don't have to modify the `extra_javascript` or `extra_css` entries\nin your `mkdocs.yml` file. The plugins automatically takes care of that.\nBoth `minify_js` and `minify_css` support the use of **globs** (e.g. `**/*.css`).\n\n[pypi-link]: https://pypi.python.org/pypi/mkdocs-minify-plugin/\n[python-image]: https://img.shields.io/pypi/pyversions/mkdocs-minify-plugin?logo=python&logoColor=aaaaaa&labelColor=333333\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An MkDocs plugin to minify HTML, JS or CSS files prior to being written to disk",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/byrnereese/mkdocs-minify-plugin"
    },
    "split_keywords": [
        "mkdocs",
        "minify",
        "publishing",
        "documentation",
        "html",
        "css"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bcd2e8d0d92421916e2ea4ff97f10a544a9bd5588eb747556701c983581df13",
                "md5": "8567786934748cba0b9669a9ba2a00ac",
                "sha256": "5fba1a3f7bd9a2142c9954a6559a57e946587b21f133165ece30ea145c66aee6"
            },
            "downloads": -1,
            "filename": "mkdocs_minify_plugin-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8567786934748cba0b9669a9ba2a00ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6723,
            "upload_time": "2024-01-29T16:11:31",
            "upload_time_iso_8601": "2024-01-29T16:11:31.851353Z",
            "url": "https://files.pythonhosted.org/packages/1b/cd/2e8d0d92421916e2ea4ff97f10a544a9bd5588eb747556701c983581df13/mkdocs_minify_plugin-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5267fe4b77e7a8ae7628392e28b14122588beaf6078b53eb91c7ed000fd158ac",
                "md5": "577e56f2dba062629e93c11dfd57b0af",
                "sha256": "bc11b78b8120d79e817308e2b11539d790d21445eb63df831e393f76e52e753d"
            },
            "downloads": -1,
            "filename": "mkdocs-minify-plugin-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "577e56f2dba062629e93c11dfd57b0af",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8366,
            "upload_time": "2024-01-29T16:11:32",
            "upload_time_iso_8601": "2024-01-29T16:11:32.982599Z",
            "url": "https://files.pythonhosted.org/packages/52/67/fe4b77e7a8ae7628392e28b14122588beaf6078b53eb91c7ed000fd158ac/mkdocs-minify-plugin-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-29 16:11:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "byrnereese",
    "github_project": "mkdocs-minify-plugin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mkdocs-minify-plugin"
}
        
Elapsed time: 0.69156s