Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 解决使用编辑器时 amis-ui 样式变量重复引入 #10015

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

ChuHoMan
Copy link
Contributor

close #9406

What

使用 amis-editor 时,会重复引用 amis-ui/scss/_components.scss

1
2

第一份来自于 amis-ui/scss/themes/cxd.scss 引入的 components.scss
第二份来自于 amis-editor-core/scss/editor.scss 引入的 components.scss

Why

因为 amis-editor 依赖 amis-ui。amis-ui 会引用相应的主题样式。
如:amis-ui/scss/themes/cxd.scss

因此第二份引入的样式是冗余的。

收益:

  1. 移除后页面样式无影响
  2. 能够降低 amis-editor-core/lib/style.css 体积 200+kb

复现案例来自于 amis 仓库中的 examples。
复现路径: npm start,访问 localhost:8080/packages/amis-editor;查看 network

开发环境:

优化前:
3
优化后:
4

生产环境:
amis-editor-core/lib/style.css 从 437kb 降低至 182 kb

How

删除 amis-editor-core 中的样式变量引用。

Copy link

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

@github-actions github-actions bot added fix style Bug or PR related to component's style labels Apr 12, 2024
@2betop
Copy link
Collaborator

2betop commented Apr 12, 2024

thx

@2betop 2betop merged commit caf7e0a into baidu:master Apr 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix style Bug or PR related to component's style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amis样式打包问题
3 participants