diff options
| author | UltraQbik <no1skill@yandex.ru> | 2024-08-27 15:44:19 +0300 |
|---|---|---|
| committer | UltraQbik <no1skill@yandex.ru> | 2024-08-27 15:44:19 +0300 |
| commit | fdda4950d518e4ddae8a548f8ff6c8b0d4cba41a (patch) | |
| tree | 8471fb2b1f657b848507425d74b12bbb8ac018f2 /src/file_man.py | |
| parent | 3263cfdee15391995532545df84b8e4144684879 (diff) | |
| download | httpy-fdda4950d518e4ddae8a548f8ff6c8b0d4cba41a.tar.gz httpy-fdda4950d518e4ddae8a548f8ff6c8b0d4cba41a.zip | |
wut?
Diffstat (limited to 'src/file_man.py')
| -rw-r--r-- | src/file_man.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/file_man.py b/src/file_man.py index 3371dd2..1759338 100644 --- a/src/file_man.py +++ b/src/file_man.py @@ -80,7 +80,7 @@ def compress_path_map(path_map: dict[str, dict[str, Any]], path_prefix: str = "c """ import brotli - from src.minimizer import minimize_html + import htmlmin if not os.path.exists(path_prefix): os.mkdir(path_prefix) for val in path_map.values(): @@ -95,8 +95,12 @@ def compress_path_map(path_map: dict[str, dict[str, Any]], path_prefix: str = "c with open(filepath, "wb") as comp: with open(val["path"], "rb") as file: comp.write( - brotli.compress(minimize_html(file.read())) - ) + brotli.compress(htmlmin.minify( + file.read().decode("utf-8"), + remove_comments=True, + remove_empty_space=True, + remove_all_empty_space=True, + reduce_boolean_attributes=True).encode("utf-8"))) else: with open(filepath, "wb") as comp: br = brotli.Compressor() |