1
0
Fork 0
mirror of https://github.com/Findus23/lw1.at.git synced 2024-09-09 04:03:45 +02:00
lw1.at/lw1/compression.py
2023-02-26 22:33:24 +01:00

13 lines
421 B
Python

from subprocess import run
from lw1.paths import output_dir
def compress_files():
for file in output_dir.glob("**/*"):
if file.is_dir():
continue
if file.suffix not in {".html", ".css", ".js", ".xml", ".map", ".json", ".ttf", ".svg"}:
continue
run(["gzip", "-k", "-f", "--best", str(file)], check=True)
run(["brotli", "-f", "--best", str(file)], check=True)