fix(config): preserve custom sidebar gradient palettes - #747
Merged
Merged
Conversation
|
|
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.
变更说明
修复 glass 外观下自定义侧栏渐变失效的问题。配置
appearance.backgrounds.leftbar.gradient.light/dark的四个颜色时,Hexo 的deepMerge会把默认四项与自定义四项合并成八项。Schema 解析结果仍是正确的四项,但 Stylus 的hexo-config读取ctx.theme.config中的八项,导致length(...) == 4分支被跳过。复现配置(写入站点的
_config.stellar.yml):配置解析后,将 Stylus 消费的两组 palette 同步为 Schema 规范化结果的副本,使自定义数组按替换语义生效。仅指定一个模式时保留另一模式的默认值,重新生成时也不会累积旧颜色。
改动范围
layout/(EJS 模板)scripts/(配置适配:scripts/events/lib/config-schema.js)source/css/(Stylus 样式)source/js/(浏览器脚本)languages/(国际化文案)docs/(方案 / 知识库 / 文档)test/config-schema.test.js:新增完整覆盖、单模式覆盖、重新生成三个回归案例。验证清单
按 AGENTS.md 的 F1 范围验证执行:
node --test test/config-schema.test.js:17/17 通过;新增的三个案例在修复前均失败,修复后均通过。hexo-renderer-stylus编译主题样式:修复前自定义颜色未进入 CSS,修复后浅色/深色的四个颜色均进入 CSS;默认配色的编译输出前后完全一致。npm run lint。node ci/check-require-decls.js。node ci/check-commit-msg.js origin/main HEAD。git diff --check。备注
本地环境为 Windows。额外运行配置热更新测试时,未修改的
test/config-hot-reload.test.js有一个路径断言失败(实际为 Windows 反斜杠路径,预期为/tmp/...);npm run reuse:check也因现有路径匹配问题失败。未将这些与本次修改无关的失败计为通过,也未扩大修复范围。本 PR 只包含配置适配和回归测试两个文件,未更改默认配色。