# 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.lt/gh/web-mini",
"name": "web-mini",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "css, html, web, www, https. minifier, css minifier, html minifier, typed, html5, min",
"author": "Ari Archer",
"author_email": "ari@ari.lt",
"download_url": null,
"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.1",
"project_urls": {
"Homepage": "https://ari.lt/gh/web-mini"
},
"split_keywords": [
"css",
" html",
" web",
" www",
" https. minifier",
" css minifier",
" html minifier",
" typed",
" html5",
" min"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8481883a576886a6bfe13638ef5dd0d2b3d0a4117ff739cc5ad677e6ea66666b",
"md5": "7d4c8b126d3b53de5cae092794729fbd",
"sha256": "7325779ee9973b3a95755abe127bfe898029b7be13ae7be6f01b23ffc5c67df3"
},
"downloads": -1,
"filename": "web_mini-1.4.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d4c8b126d3b53de5cae092794729fbd",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 20044,
"upload_time": "2025-01-02T09:39:29",
"upload_time_iso_8601": "2025-01-02T09:39:29.656503Z",
"url": "https://files.pythonhosted.org/packages/84/81/883a576886a6bfe13638ef5dd0d2b3d0a4117ff739cc5ad677e6ea66666b/web_mini-1.4.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-02 09:39:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "web-mini"
}