Strip legacy CSS from SX app: no Prism, Ghost, FontAwesome extras
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m10s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m10s
Add css_extras parameter to create_base_app. Legacy apps (blog, market etc) get the default extras (basics.css, cards.css, blog-content.css, prism.css, FontAwesome). SX app passes css_extras=[] — it uses CSSX for styling and custom highlighting, not Prism/FA/Ghost. Reduces <style id="sx-css"> from ~100KB+ of irrelevant CSS to ~5KB of Tailwind resets + only the utility rules the page actually uses. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@ def create_base_app(
|
||||
domain_services_fn: Callable[[], None] | None = None,
|
||||
no_oauth: bool = False,
|
||||
no_db: bool = False,
|
||||
css_extras: Sequence[str] | None = None,
|
||||
) -> Quart:
|
||||
"""
|
||||
Create a Quart app with shared infrastructure.
|
||||
@@ -139,17 +140,24 @@ def create_base_app(
|
||||
_styles = BASE_DIR / "static" / "styles"
|
||||
_fa_css = BASE_DIR / "static" / "fontawesome" / "css"
|
||||
if (_styles / "tw.css").exists() and not registry_loaded():
|
||||
load_css_registry(
|
||||
_styles / "tw.css",
|
||||
extra_css=[
|
||||
if css_extras is None:
|
||||
# Legacy default: all shared CSS for blog/market/etc apps
|
||||
_extra = [
|
||||
_styles / "basics.css",
|
||||
_styles / "cards.css",
|
||||
_styles / "blog-content.css",
|
||||
_styles / "prism.css",
|
||||
_fa_css / "all.min.css",
|
||||
_fa_css / "v4-shims.min.css",
|
||||
],
|
||||
url_rewrites={"../webfonts/": "/static/fontawesome/webfonts/"},
|
||||
]
|
||||
_rewrites = {"../webfonts/": "/static/fontawesome/webfonts/"}
|
||||
else:
|
||||
_extra = [_styles / e if "/" not in e else e for e in css_extras]
|
||||
_rewrites = {}
|
||||
load_css_registry(
|
||||
_styles / "tw.css",
|
||||
extra_css=_extra,
|
||||
url_rewrites=_rewrites,
|
||||
)
|
||||
|
||||
# Dev-mode: auto-reload sx templates when files change on disk
|
||||
|
||||
Reference in New Issue
Block a user