Skip to content

chore: remove duplicated preview-theme.css (keep single bundled source) - #22

Merged
anyuer678 merged 1 commit into
masterfrom
chore/dedupe-preview-theme
Sep 26, 2026
Merged

anyuer678 merged 1 commit into
masterfrom
chore/dedupe-preview-theme

Conversation

@anyuer678

Copy link
Copy Markdown
Owner

变更内容

preview-theme.css 此前被双重加载:

  • index.html 的 <link href="./preview-theme.css">(指向 public/ 副本)
  • main.js 的 import "./design-system/preview-theme.css"(src/design-system/ 副本)

两份内容完全相同(约 36KB / 1221 行)。本 PR 删除 index.html 的 <link> 与 public/preview-theme.css,仅保留 main.js 的打包引入作为唯一来源。

生产构建中该 CSS 由 Vite 打包后以 <link> 注入 <head>,注入时机与样式级联顺序均不变;开发态消除双份规则。

备注:排查中发现 components.css / preview-components.css 与 cet6-vocabulary / todo-list 仓存在字节级相同副本(同 md5),但后两者已归档,且 npm 发包需要登录凭据,跨仓去重建议后续在 kb-ui monorepo 中增加 design-tokens 包统一,本 PR 只处理仓内重复。

验证

  • npx vite build 通过(1.66s)
  • npx vitest run 88/88 全部通过

## 变更内容
- preview-theme.css 此前被双重加载:index.html <link>(public/ 副本)+ main.js import(src/design-system/ 副本),两份内容完全相同(约 36KB)
- 删除 index.html 的 <link> 与 public/preview-theme.css,仅保留 main.js 的打包引入
- 生产构建中该 CSS 由 Vite 以 <link> 注入 <head>,加载顺序与注入时机不变;开发态不再有双份规则

## 验证
- [x] npx vite build 通过(1.66s)
- [x] npx vitest run 88/88 全部通过
@anyuer678
anyuer678 merged commit f474fd9 into master Sep 26, 2026
7 checks passed
@anyuer678
anyuer678 deleted the chore/dedupe-preview-theme branch September 26, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant