Skip to content

AI video skill for Claude Code & Codex — cinematic, editable product promos with Remotion: 124 shot recipe cards, 150 motion previews, beat sync, sound design, Motion Workbench & JianYing (CapCut CN) export.

fix: 部署加资源哈希防缓存错配 + 首页语言按钮图标对齐 (#58)

Yihaob0cb89173c92
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml
index b3a2967..c1d0cb3 100644
--- a/.github/workflows/deploy-pages.yml
+++ b/.github/workflows/deploy-pages.yml
@@ -46,6 +46,30 @@ jobs:
gallery/ site/
touch site/.nojekyll
+ # Pages 给静态资源发 cache-control: max-age=600,部署后十分钟内浏览器
+ # 会拿旧 styles.css / app.js 配新 HTML(实际踩过:侧栏与顶栏样式全崩)。
+ # 按文件内容哈希给资源链接打 ?v=,每个 HTML 版本只引用自己那代资源。
+ - name: Stamp asset URLs for cache busting
+ run: |
+ python3 - <<'EOF'
+ import hashlib, pathlib, re
+ site = pathlib.Path('site')
+ assets = {}
+ for name in ('styles.css', 'app.js', 'showcase.js', 'translations.js'):
+ path = site / name
+ if path.exists():
+ assets[name] = hashlib.md5(path.read_bytes()).hexdigest()[:8]
+ pattern = re.compile(
+ r'(?P<attr>href|src)="\./(?P<name>' + '|'.join(map(re.escape, assets)) + r')(?:\?v=[^"]*)?"')
+ for html in sorted(site.glob('*.html')):
+ text = html.read_text(encoding='utf-8')
+ stamped, hits = pattern.subn(
+ lambda m: f'{m["attr"]}="./{m["name"]}?v={assets[m["name"]]}"', text)
+ if hits:
+ html.write_text(stamped, encoding='utf-8')
+ print(f'{html.name}: stamped {hits} asset link(s)')
+ EOF
+
- name: Download motion previews from the gallery-media release
env:
GH_TOKEN: ${{ github.token }}
diff --git a/gallery/index.html b/gallery/index.html
index 74f2f4d..ac53a26 100644
--- a/gallery/index.html
+++ b/gallery/index.html
@@ -151,6 +151,12 @@
transition: color 150ms ease, border-color 150ms ease;
}
.language-toggle:hover { color: var(--text); border-color: rgba(211, 146, 60, 0.65); }
+ /* 图标外壳必须自己是 flex:默认 block 的话 svg 会贴在行高盒顶部,
+ 比文字中线高约 2px(线上实测 36.3 vs 38.6) */
+ .language-toggle-icon {
+ display: inline-flex;
+ align-items: center;
+ }
.language-toggle svg {
width: 15px;
height: 15px;
@@ -415,7 +421,7 @@
<nav class="topbar-nav" aria-label="Site">
<a class="topbar-nav-link" href="./showcase.html" data-l10n="navShowcase">Showcase</a>
<button class="language-toggle" id="languageToggle" type="button" aria-label="Switch to Chinese">
- <span aria-hidden="true">
+ <span class="language-toggle-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" focusable="false"><circle cx="12" cy="12" r="9.2"/><path d="M2.8 12h18.4M12 2.8c2.5 2.6 3.8 5.7 3.8 9.2S14.5 18.6 12 21.2c-2.5-2.6-3.8-5.7-3.8-9.2S9.5 5.4 12 2.8Z"/></svg>
</span>
<span id="languageToggleLabel">中文</span>