fix: 部署加资源哈希防缓存错配 + 首页语言按钮图标对齐 - #58
Merged
Merged
Conversation
Pages 对静态资源发 cache-control: max-age=600,PR #57 部署后十分钟窗口里 浏览器拿旧 styles.css 配新 library.html,侧栏关注面板和顶栏 toggle 全崩 (图标撑满、行堆叠、链接带下划线)。装配后加一步 stamp:按文件内容 md5 前 8 位改写 site/*.html 里 styles.css / app.js / showcase.js / translations.js 的引用,每个 HTML 版本只引用自己那代资源,哈希不变则沿用 浏览器缓存。只作用于部署产物,仓库内的 gallery/ 与本地预览不受影响。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
图标外壳 span 默认 display:block,svg 贴在 19.5px 行高盒顶部,中线比文字 高 2.3px(线上实测 svg 36.3 / 文字 38.6)。补 .language-toggle-icon inline-flex 后两者中线都是 38.6,delta 0。library/showcase 的 .topbar-toggle-icon 本来就有这条规则,实测 delta 0,不受影响。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
两个线上小毛病,一起修。
1. 新 HTML 配旧样式(缓存错配)
现象:PR #57 部署完成后,线上 library 页样式崩掉:关注面板行堆叠、图标撑满整列、链接带下划线,顶栏两个 toggle 的图标变成大黑圆。
根因:不是没部署——线上
styles.css抓下来是新的(.topbar-toggle/.follow-row/.link-arrow都在)。GitHub Pages 给静态资源发cache-control: max-age=600,而 HTML 里引用 css/js 没有版本号,所以部署后十分钟窗口里浏览器用缓存里的旧 styles.css 渲染了新 HTML:新类名在旧 CSS 里没有规则,SVG 失去尺寸约束、<a>没去下划线、flex 失效变堆叠。硬刷即恢复,但每次改 gallery 都有这个窗口。改法:deploy-pages 装配后加一步 stamp,按文件内容 md5 前 8 位改写
site/*.html的资源引用。site/),仓库里的gallery/与本地预览不受影响,无需手工维护版本号。2. 首页语言按钮图标与文字不在一条水平线上
图标外壳
span默认display: block,15px 的 svg 贴在 19.5px 行高盒顶部,中线比文字高 2.3px(线上实测 svg 36.3 / 文字 38.6)。补上.language-toggle-icon { display: inline-flex }后两者中线都是 38.6。library / showcase 的
.topbar-toggle-icon本来就有这条规则,实测 delta 0,是我在首页那份内联 CSS 里漏了。实测
site/跑同一段 stamp 脚本:library 打 3 个链接、showcase 打 2 个,起 http 服务确认引用生效;workflow YAML 过yaml.safe_load。getBoundingClientRect中线:修前 delta 2.3px,修后 0。🤖 Generated with Claude Code