diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index e2ba377..a08ff49 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -22,7 +22,7 @@ requires = [ "lesscpy>=0.13", "jinja2>2.11", "lru-dict>=1.1.6", - "htmlmin>=0.1.12" + "css_html_js_minify>=2.5.5" ] resources = [ "web/*/*/*", diff --git a/maloja/server.py b/maloja/server.py index 4ef5744..01cc5e5 100755 --- a/maloja/server.py +++ b/maloja/server.py @@ -34,7 +34,7 @@ import os import setproctitle import pkg_resources import math -from htmlmin.decorator import htmlmin +from css_html_js_minify import html_minify # url handling import urllib @@ -89,6 +89,10 @@ def generate_css(): css = generate_css() + +def clean_html(inp): + return html_minify(inp) + #os.makedirs("web/css",exist_ok=True) #with open("web/css/style.css","w") as f: # f.write(css) @@ -219,7 +223,6 @@ def static_html_private(name): def static_html_public(name): return static_html(name) -@htmlmin def static_html(name): if name in aliases: redirect(aliases[name]) linkheaders = ["; rel=preload; as=style"] @@ -247,7 +250,7 @@ def static_html(name): if settings.get_settings("DEV_MODE"): jinja_environment.cache.clear() log("Generated page {name} in {time:.5f}s (Jinja)".format(name=name,time=clock.stop()),module="debug_performance") - return res + return clean_html(res) # Shortlinks diff --git a/maloja/web/jinja/start.jinja b/maloja/web/jinja/start.jinja index b4c9138..91b13d4 100644 --- a/maloja/web/jinja/start.jinja +++ b/maloja/web/jinja/start.jinja @@ -12,7 +12,7 @@ {% endblock %} -{% block content %} +{% block content -%} @@ -28,13 +28,13 @@

- {% for r in xcurrent %} + {% for r in xcurrent -%} - {% endfor %} + {%- endfor %} @@ -52,13 +52,13 @@

- {% for r in xcurrent %} + {% for r in xcurrent -%} - {% endfor %} + {%- endfor %}
@@ -66,18 +66,18 @@

Last Scrobbles

- {% for range in xcurrent %} + {% for range in xcurrent -%} {{ range.localisation }} {{ db.get_scrobbles_num(timerange=range.range) }} - {% endfor %} + {%- endfor %}

- {% with amountkeys = {"perpage":15,"page":0}, shortTimeDesc=True %} + {%- with amountkeys = {"perpage":15,"page":0}, shortTimeDesc=True -%} {% include 'partials/scrobbles.jinja' %} - {% endwith %} + {%- endwith -%} @@ -89,21 +89,21 @@

Pulse

- {% for range in xranges %} + {% for range in xranges -%} {{ range.localisation }} {{ "|" if not loop.last }} - {% endfor %} + {%- endfor %}

- {% for range in xranges %} + {% for range in xranges -%} - {% endfor %} + {%- endfor %}
-{% endblock %} +{%- endblock %}