From 1574887f1d9bc8a3761b64897d98ef7d62c5af96 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 26 Sep 2023 19:17:42 +0300 Subject: [PATCH] dynamically add new css and js folders to prevent human error --- files/helpers/assetcache.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/files/helpers/assetcache.py b/files/helpers/assetcache.py index 4b3334d229..ad8818da8d 100644 --- a/files/helpers/assetcache.py +++ b/files/helpers/assetcache.py @@ -8,14 +8,19 @@ import gevent_inotifyx as inotify from files.helpers.config.const import * ASSET_DIR = 'files/assets' -ASSET_SUBDIRS = ['/css', '/js', '/js/vendor'] ASSET_URL = '/assets/' ASSET_CACHE = defaultdict(lambda: None) +ASSET_SUBDIRS = ['/css', '/js'] if IS_DKD(): ASSET_SUBDIRS.extend(['/events/DKD/js']) elif IS_FISTMAS(): - ASSET_SUBDIRS.extend(['/events/fistmas/css', '/events/fistmas/css/themes', '/events/fistmas/js', '/events/fistmas/js/vendor']) + ASSET_SUBDIRS.extend(['/events/fistmas/css', '/events/fistmas/js']) + +new_dirs = [] +for directory in ASSET_SUBDIRS: + new_dirs += [x[0].split(ASSET_DIR)[1] for x in os.walk(f'{ASSET_DIR}{directory}')] +ASSET_SUBDIRS = new_dirs def assetcache_build(asset_dir, subdirs): for subdir in subdirs: