Vendor Alpine, Flowbite and Datepicker bundles locally
Serve alpinejs 3.15.12, @alpinejs/mask 3.15.12, flowbite 2.4.1 and flowbite-datepicker 2.0.0 from games/static/js/ instead of jsdelivr, so pages (and browser tests) work without network access. Adds the StaticScript primitive for vendored UMD bundles, which cannot be loaded as ES modules. https://claude.ai/code/session_01BKurBhE3Qj25p7Bfsg7EeK
This commit is contained in:
@@ -59,6 +59,7 @@ from common.components.primitives import (
|
||||
SearchField,
|
||||
SimpleTable,
|
||||
Span,
|
||||
StaticScript,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
TableTd,
|
||||
@@ -112,6 +113,7 @@ __all__ = [
|
||||
"searchselect_selected",
|
||||
"SimpleTable",
|
||||
"Span",
|
||||
"StaticScript",
|
||||
"Label",
|
||||
"TableHeader",
|
||||
"TableRow",
|
||||
|
||||
@@ -554,6 +554,12 @@ def ExternalScript(url: str) -> SafeText:
|
||||
return mark_safe(f'<script src="{url}"></script>')
|
||||
|
||||
|
||||
def StaticScript(filename: str) -> SafeText:
|
||||
"""A plain (classic, non-module) `<script src=...>` tag for a static JS
|
||||
file — for vendored UMD bundles, which break inside module scope."""
|
||||
return mark_safe(f'<script src="{static("js/" + filename)}"></script>')
|
||||
|
||||
|
||||
def YearPicker(
|
||||
year: int | None = None,
|
||||
available_years: tuple[int, ...] = (),
|
||||
|
||||
Reference in New Issue
Block a user