Minify HTML
library to remove white spaces from HTML to reduce filesize
Created:
wilsonzlin/minify-html : Extremely fast and smart HTML + JS + CSS minifier, available for Rust, Deno, Java, Node.js, Python, Ruby, and WASM
The Python library on pypi.
Using the Python library:
# code/example_minifyhtml.py
#!/usr/bin/env python
import minify_html
with open("output/index.html") as f:
= f.read()
t print(t)
= minify_html.minify(
o
t,=True,
do_not_minify_doctype=True,
keep_spaces_between_attributes=True,
ensure_spec_compliant_unquoted_attribute_values
)print(o)