mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
b4d9825409
Ported gradio website into gradio repository, now launched as a docker service from gradio/website
19 lines
807 B
Python
19 lines
807 B
Python
import json
|
|
import os
|
|
|
|
with open("generated/manifest.json") as manifest:
|
|
style_map = json.load(manifest)
|
|
|
|
for folder in ("generated", "dist"):
|
|
for root, _, files in os.walk(folder):
|
|
for file in files:
|
|
if file.endswith(".html"):
|
|
with open(os.path.join(root, file), encoding='utf-8') as old_file:
|
|
content = old_file.read()
|
|
for old_name, new_name in style_map.items():
|
|
content = content.replace(old_name, new_name)
|
|
with open(os.path.join(root, file), "w", encoding='utf-8') as new_file:
|
|
new_file.write(content)
|
|
elif file.startswith("style.") and file.endswith(".css") and file not in list(style_map.values()):
|
|
os.remove(os.path.join(root, file))
|