From 777575619c037c5c231e89e7dc784a66d10079b4 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Wed, 28 Sep 2022 01:55:10 +0000 Subject: [PATCH] Add and use Flask-Minify. --- requirements.txt | 3 ++- undercover/__init__.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 18bfade..39a47aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,9 @@ bcrypt==4.0.0 click==8.1.3 email-validator==1.3.0 Flask==2.2.2 -Flask-WTF==1.0.1 +Flask-Minify=0.39 Flask-SQLAlchemy==2.5.1 +Flask-WTF==1.0.1 gunicorn==20.1.0 itsdangerous==2.1.2 Jinja2==3.1.2 diff --git a/undercover/__init__.py b/undercover/__init__.py index d6ea145..262f658 100644 --- a/undercover/__init__.py +++ b/undercover/__init__.py @@ -4,6 +4,7 @@ import os import sys from flask import Flask +from flask_minify import Minify import undercover.routes from undercover.css import optimize_css_file @@ -13,6 +14,7 @@ def create_app(test_config=None): optimize_css_file() app = Flask(__name__, instance_relative_config=True) + Minify(app=app, html=True, js=True, cssless=True) secret_key = os.environ.get('UNDERCOVER_SECRET_KEY') if not secret_key: sys.stderr.write("WARNING: UNDERCOVER_SECRET_KEY is not defined! Application may be insecure.\n")