web-mini


Nameweb-mini JSON
Version 1.4.0 PyPI version JSON
download
home_pagehttps://ari-web.xyz/gh/web-mini
Summaryweb-mini -- efficient css and html minifer inspired by css-html-js-minify
upload_time2023-10-31 19:47:58
maintainer
docs_urlNone
authorAri Archer
requires_python
licenseGPLv3+
keywords css html web www https. minifier css minifier html minifier typed html5 min
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # web-mini

> web-mini -- efficient css and html minifer inspired by https://pypi.org/project/css-html-js-minify/

# examples

**note** `minify_html` does not handle `style` tags -- handle css minification
( only very basic stuff that works for html too ) inline urself

## singlethreaded

```py
import web_mini

print(
    web_mini.html.minify_html(
        r"""
<h1>hello world</h1>

<p>this is my very cool
website :)</p>

<pre>
int main(void) {
    return 0;
}
</pre>
"""
    )
)

print(
    web_mini.css.minify_css(
        r"""
body {
    margin: auto;
    padding: 2rem;
    max-width: 1100px;
    min-height: 100vh;
    text-rendering: optimizeSpeed;
}

li {
    margin: 0.5em;
}

code {
    white-space: pre-wrap !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        -webkit-animation-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;

        -webkit-animation-iteration-count: 1 !important;
        animation-iteration-count: 1 !important;

        -webkit-transition-duration: 0.01ms !important;
        -o-transition-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;

        scroll-behavior: auto !important;;
    }
}
"""
    )
)
```

outputs :

```
<h1>hello world</h1> <p>this is my very cool website :)</p> <pre>
int main(void) {
    return 0;
}
</pre>
body{margin:auto;padding:2rem;max-width:1100px;min-height:100vh;text-rendering:optimizeSpeed}li{margin:.5em}code{white-space:pre-wrap !important}@media (prefers-reduced-motion:reduce){*,*::before,*::after{-webkit-animation-duration:.01ms !important;animation-duration:.01ms !important;-webkit-animation-iteration-count:1 !important;animation-iteration-count:1 !important;-webkit-transition-duration:.01ms !important;-o-transition-duration:.01ms !important;transition-duration:.01ms !important;scroll-behavior:auto !important;}}
```

## usage with threading

if ur using web-mini with threading make sure to call `compileall()` so caching doesnt get in the way

```py
import web_mini

web_mini.compileall()

# or :
# web_mini.css.css_fns.compileall()
# web_mini.html.html_fns.compileall()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://ari-web.xyz/gh/web-mini",
    "name": "web-mini",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "css,html,web,www,https. minifier,css minifier,html minifier,typed,html5,min",
    "author": "Ari Archer",
    "author_email": "ari.web.xyz@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# web-mini\n\n> web-mini -- efficient css and html minifer inspired by https://pypi.org/project/css-html-js-minify/\n\n# examples\n\n**note** `minify_html` does not handle `style` tags -- handle css minification\n( only very basic stuff that works for html too ) inline urself\n\n## singlethreaded\n\n```py\nimport web_mini\n\nprint(\n    web_mini.html.minify_html(\n        r\"\"\"\n<h1>hello world</h1>\n\n<p>this is my very cool\nwebsite :)</p>\n\n<pre>\nint main(void) {\n    return 0;\n}\n</pre>\n\"\"\"\n    )\n)\n\nprint(\n    web_mini.css.minify_css(\n        r\"\"\"\nbody {\n    margin: auto;\n    padding: 2rem;\n    max-width: 1100px;\n    min-height: 100vh;\n    text-rendering: optimizeSpeed;\n}\n\nli {\n    margin: 0.5em;\n}\n\ncode {\n    white-space: pre-wrap !important;\n}\n\n@media (prefers-reduced-motion: reduce) {\n    *,\n    *::before,\n    *::after {\n        -webkit-animation-duration: 0.01ms !important;\n        animation-duration: 0.01ms !important;\n\n        -webkit-animation-iteration-count: 1 !important;\n        animation-iteration-count: 1 !important;\n\n        -webkit-transition-duration: 0.01ms !important;\n        -o-transition-duration: 0.01ms !important;\n        transition-duration: 0.01ms !important;\n\n        scroll-behavior: auto !important;;\n    }\n}\n\"\"\"\n    )\n)\n```\n\noutputs :\n\n```\n<h1>hello world</h1> <p>this is my very cool website :)</p> <pre>\nint main(void) {\n    return 0;\n}\n</pre>\nbody{margin:auto;padding:2rem;max-width:1100px;min-height:100vh;text-rendering:optimizeSpeed}li{margin:.5em}code{white-space:pre-wrap !important}@media (prefers-reduced-motion:reduce){*,*::before,*::after{-webkit-animation-duration:.01ms !important;animation-duration:.01ms !important;-webkit-animation-iteration-count:1 !important;animation-iteration-count:1 !important;-webkit-transition-duration:.01ms !important;-o-transition-duration:.01ms !important;transition-duration:.01ms !important;scroll-behavior:auto !important;}}\n```\n\n## usage with threading\n\nif ur using web-mini with threading make sure to call `compileall()` so caching doesnt get in the way\n\n```py\nimport web_mini\n\nweb_mini.compileall()\n\n# or :\n# web_mini.css.css_fns.compileall()\n# web_mini.html.html_fns.compileall()\n```\n",
    "bugtrack_url": null,
    "license": "GPLv3+",
    "summary": "web-mini -- efficient css and html minifer inspired by css-html-js-minify",
    "version": "1.4.0",
    "project_urls": {
        "Homepage": "https://ari-web.xyz/gh/web-mini"
    },
    "split_keywords": [
        "css",
        "html",
        "web",
        "www",
        "https. minifier",
        "css minifier",
        "html minifier",
        "typed",
        "html5",
        "min"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a3db3051eee1e22a9d43a55ef0d933d66e1f3322587e7026a7ddea21868b6ed",
                "md5": "a19da64551b0cfa17d6e8bd149338159",
                "sha256": "4facc0f215b1c6e05623caa55047f192d852dd75d0733639ca9f92eedad01286"
            },
            "downloads": -1,
            "filename": "web_mini-1.4.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a19da64551b0cfa17d6e8bd149338159",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 20058,
            "upload_time": "2023-10-31T19:47:58",
            "upload_time_iso_8601": "2023-10-31T19:47:58.638000Z",
            "url": "https://files.pythonhosted.org/packages/3a/3d/b3051eee1e22a9d43a55ef0d933d66e1f3322587e7026a7ddea21868b6ed/web_mini-1.4.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-31 19:47:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "web-mini"
}
        
Elapsed time: 0.13524s