event asset caching

master
geese_suck 2022-11-29 14:01:25 -08:00
parent 5056f09380
commit d79ad8c1f0
Signed by: geese_suck
GPG Key ID: 4D09E4B0A7264746
2 changed files with 8 additions and 2 deletions

View File

@ -5,11 +5,16 @@ from collections import defaultdict
import gevent
import gevent_inotifyx as inotify
from files.helpers.const import HOLIDAY_EVENT
ASSET_DIR = 'files/assets'
ASSET_SUBDIRS = ['/css', '/js', '/js/vendor']
ASSET_URL = '/assets/'
ASSET_CACHE = defaultdict(lambda: None)
if HOLIDAY_EVENT:
ASSET_SUBDIRS.extend(['/css/event', '/js/event'])
def assetcache_build(asset_dir, subdirs):
for subdir in subdirs:
for root, dirs, files in os.walk(asset_dir + subdir):

View File

@ -116,7 +116,7 @@
}
</style>
{% endif %}
{% if include_user_css %}
{% if include_user_css and not EVENT_STYLES %}
<link rel="stylesheet" href="{{('css/'~v.theme~'.css') | asset}}">
{% if v.css and not request.path.startswith('/settings/css') %}
<style>
@ -147,7 +147,8 @@
{% endif %}
{% if EVENT_STYLES %}
<link rel="stylesheet" href="/assets/css/event/{{EVENT_STYLES}}">
{% set EVENT_STYLES = 'css/event/'+EVENT_STYLES %}
<link rel="stylesheet" href="{{EVENT_STYLES | asset}}">
{% endif %}
{% if request.path == '/chat' %}