feat: Link compiled CSS bundle for non-JS client

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-12-04 18:16:50 +00:00
parent 32cbf47d95
commit 85b6fbabf3
2 changed files with 17 additions and 5 deletions

View File

@@ -40,6 +40,17 @@ def new_id():
return nid
build_folder = './build'
css_file = None
try:
css_dir = os.path.join(build_folder, 'static', 'css')
for f in os.listdir(css_dir):
if f.endswith('.css'):
css_file = f
break
except FileNotFoundError:
logging.warning('CSS file not found. Run webclient build.')
flask_app = Flask(__name__, template_folder=build_folder, static_folder=build_folder, static_url_path='')
cors = CORS(flask_app)
@@ -161,6 +172,7 @@ def index():
url='news.t0.vc',
description='Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode',
robots='index',
css_file=css_file,
)
@flask_app.route('/<sid>', strict_slashes=False)
@@ -192,6 +204,7 @@ def static_story(sid):
robots='noindex',
story=story,
show_comments=request.path.endswith('/c'),
css_file=css_file,
)
http_server = WSGIServer(('', 33842), flask_app)

View File

@@ -30,16 +30,15 @@
-->
<title>{{ title }}</title>
{% if css_file %}
<link href="/static/css/{{ css_file }}" rel="stylesheet">
{% endif %}
<style>
html {
overflow-y: scroll;
}
body {
background: #000;
}
.nojs {
color: white;
max-width: 32rem;
background: #eeeeee;
}
</style>
</head>