Fix js includes

This commit is contained in:
Digital Studium 2023-07-23 17:30:20 +03:00
parent 5ecbb0f0a5
commit 278831ee68
2 changed files with 17 additions and 3 deletions

View File

@ -8,7 +8,7 @@ Example website: https://git.digitalstudium.com/digitalstudium/digitalstudium.co
## Installation (Linux): ## Installation (Linux):
``` ```
curl https://git.digitalstudium.com/attachments/2ea775b4-f96f-4e57-a39f-bb946b8117da -o crater && chmod +x crater && sudo mv crater /usr/local/bin curl https://git.digitalstudium.com/attachments/43d72c45-a0ba-4696-bc0f-6e30a50025dd -o crater && chmod +x crater && sudo mv crater /usr/local/bin
``` ```
## Usage: ## Usage:
Development: Development:

View File

@ -53,6 +53,9 @@ def develop(prod):
event_handler = Develop() event_handler = Develop()
observer = Observer() observer = Observer()
observer.schedule(event_handler, path='content', recursive=True) observer.schedule(event_handler, path='content', recursive=True)
observer.schedule(event_handler, path='assets', recursive=True)
observer.schedule(event_handler, path='static', recursive=True)
observer.schedule(event_handler, path='config.yaml')
observer.schedule(event_handler, path=f"themes/{config['theme']}", recursive=True) observer.schedule(event_handler, path=f"themes/{config['theme']}", recursive=True)
observer.start() observer.start()
running = True running = True
@ -135,8 +138,19 @@ def crater(prod=False):
write_file(f"public/{language}/index.html", html) write_file(f"public/{language}/index.html", html)
for source_folder in ('static', f"themes/{config['theme']}/static"): # copy images/css/js from theme
shutil.copytree(source_folder, 'public', dirs_exist_ok=True) shutil.copytree(f"themes/{config['theme']}/static/images", 'public/images', dirs_exist_ok=True)
shutil.copytree(f"themes/{config['theme']}/static/css", 'public/css', dirs_exist_ok=True)
if 'js_includes' in config:
for include in config['js_includes']:
copy_file(f"themes/{config['theme']}/static/js/{include}", 'public/js/')
# copy css/images from site static folder
if 'custom_css' in config:
shutil.copytree('static/css', 'public/css', dirs_exist_ok=True)
copy_file('static/logo.svg', 'public/')
copy_file('static/favicon.ico', 'public/')
develop(prod) develop(prod)