1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Changed html minifier

This commit is contained in:
Krateng 2020-09-23 16:26:54 +02:00
parent 98830b0803
commit 5e93eb15f4
No known key found for this signature in database
GPG Key ID: 46735607861C6FCE
3 changed files with 27 additions and 24 deletions

View File

@ -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/*/*/*",

View File

@ -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 = ["</style.css>; 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

View File

@ -12,7 +12,7 @@
<script src="/cookies.js"></script>
{% endblock %}
{% block content %}
{% block content -%}
<!-- ARTIST CHARTS -->
@ -28,13 +28,13 @@
<br/><br/>
{% for r in xcurrent %}
{% for r in xcurrent -%}
<span class="stat_module_topartists topartists_{{ r.identifier }}" style="display:none;">
{% with limitkeys = {"timerange":r.range} %}
{%- with limitkeys = {"timerange":r.range} -%}
{% include 'partials/charts_artists_tiles.jinja' %}
{% endwith %}
{%- endwith -%}
</span>
{% endfor %}
{%- endfor %}
@ -52,13 +52,13 @@
<br/><br/>
{% for r in xcurrent %}
{% for r in xcurrent -%}
<span class="stat_module_toptracks toptracks_{{ r.identifier }}" style="display:none;">
{% with limitkeys = {"timerange":r.range} %}
{%- with limitkeys = {"timerange":r.range} -%}
{% include 'partials/charts_tracks_tiles.jinja' %}
{% endwith %}
{%- endwith -%}
</span>
{% endfor %}
{%- endfor %}
<div class="sidelist">
@ -66,18 +66,18 @@
<h1><a href="/scrobbles">Last Scrobbles</a></h1>
{% for range in xcurrent %}
{% for range in xcurrent -%}
<span class="stats">{{ range.localisation }}</span>
<a href='/scrobbles?in={{ range.identifier }}'>{{ db.get_scrobbles_num(timerange=range.range) }}</a>
{% endfor %}
{%- endfor %}
<br/><br/>
<span class="stat_module">
{% with amountkeys = {"perpage":15,"page":0}, shortTimeDesc=True %}
{%- with amountkeys = {"perpage":15,"page":0}, shortTimeDesc=True -%}
{% include 'partials/scrobbles.jinja' %}
{% endwith %}
{%- endwith -%}
</span>
@ -89,21 +89,21 @@
<!-- PULSE -->
<h1><a class="stat_link_pulse" href="/pulse?trail=1&step=month">Pulse</a></h1>
{% for range in xranges %}
{% for range in xranges -%}
<span onclick="showRangeManual('pulse','{{ range.identifier }}')" class="stat_selector_pulse selector_pulse_{{ range.identifier }}">{{ range.localisation }}</span>
{{ "|" if not loop.last }}
{% endfor %}
{%- endfor %}
<br/><br/>
{% for range in xranges %}
{% for range in xranges -%}
<span class="stat_module_pulse pulse_{{ range.identifier }}" style="display:none;">
{% with limitkeys={"since":range.firstrange},delimitkeys={"step":range.identifier} %}
{%- with limitkeys={"since":range.firstrange},delimitkeys={"step":range.identifier} -%}
{% include 'partials/pulse.jinja' %}
{% endwith %}
{%- endwith -%}
</span>
{% endfor %}
{%- endfor %}
</div>
{% endblock %}
{%- endblock %}