Skip to content

Commit a7c70b4

Browse files
committed
Apply code formatting
1 parent b2c955a commit a7c70b4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

violetear/app.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def style(self, path: str, sheet: StyleSheet):
125125
"""
126126
if path not in self.served_styles:
127127
# Register the route dynamically (just once)
128+
if not path.startswith("/"):
129+
path = f"/{path}"
130+
128131
@self.api.get(path)
129132
def serve_css():
130133
# Render the full CSS content
@@ -141,10 +144,9 @@ def _register_document_styles(self, doc: Document):
141144
and registers their routes on the fly.
142145
"""
143146
for resource in doc.head.styles:
144-
if isinstance(resource, StyleResource):
145-
# If it has a sheet object AND a URL, it needs to be served
146-
if resource.sheet and resource.href and not resource.inline:
147-
self.style(resource.href, resource.sheet)
147+
# If it has a sheet object AND a URL, it needs to be served
148+
if resource.sheet and resource.href and not resource.inline:
149+
self.style(resource.href, resource.sheet)
148150

149151
def _generate_server_stubs(self) -> str:
150152
"""

0 commit comments

Comments
 (0)