Switched to STATIC_DIR

This commit is contained in:
2025-08-09 01:18:39 +00:00
parent 0461c0d1d1
commit 27426d8104

View File

@@ -19,6 +19,7 @@ from .objects import JSInterface
from .runtime_paths import ensure_assets from .runtime_paths import ensure_assets
from backend.lib.config import Config from backend.lib.config import Config
app = FastAPI() app = FastAPI()
STATIC_DIR, TEMPLATES_DIR = ensure_assets() STATIC_DIR, TEMPLATES_DIR = ensure_assets()
templates = Jinja2Templates(directory=str(TEMPLATES_DIR)) templates = Jinja2Templates(directory=str(TEMPLATES_DIR))
@@ -149,15 +150,19 @@ class FastAPIServer():
def compile_static_files(self): def compile_static_files(self):
"""Compile static files for web frontend.""" """Compile static files for web frontend."""
_pyShelf_src = sass.compile( _pyShelf_src = sass.compile(
filename='src/frontend/static/styles/pyShelf.sass', filename=f"{STATIC_DIR}/styles/pyShelf.sass",
source_map_filename='src/frontend/static/styles/pyShelf.sass', # filename='src/frontend/static/styles/pyShelf.sass',
source_map_filename=f"{STATIC_DIR}/styles/pyShelf.sass",
# source_map_filename='src/frontend/static/styles/pyShelf.sass',
output_style='compressed', output_style='compressed',
include_paths=[ include_paths=[
'node_modules', 'node_modules',
'src/frontend/static/styles' f"{STATIC_DIR}src/frontend/static/styles"
# 'src/frontend/static/styles'
] ]
) )
with open('src/frontend/static/styles/pyShelf.css', 'w') as _pyShelf: with open(f"{STATIC_DIR}/styles/pyShelf.css", 'w') as _pyShelf:
# with open('src/frontend/static/styles/pyShelf.css', 'w') as _pyShelf:
_pyShelf.write(_pyShelf_src[0]) _pyShelf.write(_pyShelf_src[0])
self.JSInterface.install() self.JSInterface.install()