diff --git a/app.py b/app.py index be59d0f..7968148 100644 --- a/app.py +++ b/app.py @@ -14,20 +14,20 @@ app = Flask(__name__) locales.ensure_loaded() +# CSS Compilation and minification if app.debug: - # CSS Compilation and minification css = compile_sass(filename="static/style.scss", output_style="compressed") with open("static/style.css", "w", encoding="utf-8") as f: f.write(css) - # JS minification - with open("static/script.js", encoding="utf-8") as f: - js = f.read() - js = re.sub(r"/\*.*?\*/", "", js, flags=re.S) - js = re.sub(r"//.*", "", js) - js = re.sub(r"\s+", " ", js).strip() - with open("static/script.min.js", "w", encoding="utf-8") as f: - f.write(js) +# JS minification +with open("static/script.js", encoding="utf-8") as f: + js = f.read() +js = re.sub(r"/\*.*?\*/", "", js, flags=re.S) +js = re.sub(r"//.*", "", js) +js = re.sub(r"\s+", " ", js).strip() +with open("static/script.min.js", "w", encoding="utf-8") as f: + f.write(js) @app.before_request