feat: theme-level blocks.css takes priority over platform asset

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-22 17:49:12 +08:00
parent 712ccac058
commit 960f7b1002
2 changed files with 19 additions and 1 deletions
+6 -1
View File
@@ -36,6 +36,11 @@ def output_path(dist,route):
if not target.is_relative_to(dist.resolve()):raise ValueError('非法生成目标目录')
return out
def copy_blocks_css(theme_dir,dist_assets):
"""Theme-provided blocks.css wins; platform default is the fallback."""
src=theme_dir/'blocks.css' if (theme_dir/'blocks.css').is_file() else ROOT/'app'/'static'/'blocks.css'
shutil.copy2(src,dist_assets/'blocks.css')
def link(path):
return (path or '/').lstrip('/') or './'
@@ -188,7 +193,7 @@ def build(site_id,mirror=False):
theme_pin=theme_store.pinned(site_id)
theme_dir=theme_store.resolve(site['theme'],theme_pin['version'] if theme_pin and theme_pin['theme_id']==site['theme'] else None)
shutil.copy2(theme_dir/'theme.css',dist/'assets'/'theme.css')
shutil.copy2(ROOT/'app'/'static'/'blocks.css',dist/'assets'/'blocks.css')
copy_blocks_css(theme_dir,dist/'assets')
shutil.copy2(ROOT/'app'/'static'/'pro-base.css',dist/'assets'/'pro-base.css')
shutil.copy2(ROOT/'app'/'static'/'commercial.css',dist/'assets'/'commercial.css')
visuals=theme_dir/'visual'