diff --git a/apiserver/server.py b/apiserver/server.py index 022875a..c8ebe1a 100644 --- a/apiserver/server.py +++ b/apiserver/server.py @@ -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('/', 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) diff --git a/webclient/public/index.html b/webclient/public/index.html index 712e04a..d396bb6 100644 --- a/webclient/public/index.html +++ b/webclient/public/index.html @@ -30,16 +30,15 @@ --> {{ title }} + {% if css_file %} + + {% endif %}