From 6a00d1da5a8a5fa47af1bf1ab5d3cd206c599841 Mon Sep 17 00:00:00 2001 From: melMass Date: Sat, 2 Sep 2023 18:22:14 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20a=20static=20assets?= =?UTF-8?q?=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit much easier to manage custom css and js on endpoints! --- __init__.py | 3 +++ endpoint.py | 10 +--------- html/style.css | 9 ++++++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index 4440b9f..7fec35a 100644 --- a/__init__.py +++ b/__init__.py @@ -192,6 +192,9 @@ if hasattr(PromptServer, "instance"): "LoadFaceAnalysisModel": restore_deps, } + PromptServer.instance.app.router.add_static( + "/mtb-assets/", path=(here / "html").as_posix(), name="static" + ) @PromptServer.instance.routes.get("/mtb/status") async def get_full_library(request): from . import endpoint diff --git a/endpoint.py b/endpoint.py index b80823e..2adc583 100644 --- a/endpoint.py +++ b/endpoint.py @@ -123,21 +123,13 @@ def render_table(table_dict, sort=True, title=None): def render_base_template(title, content): - css_content = "" - css_path = here / "html" / "style.css" - if css_path: - with open(css_path, "r") as css_file: - css_content = css_file.read() - github_icon_svg = """""" return f""" {title} - +