Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-maps-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ossa-doc": patch
---

icon css usage when dynamic import
8 changes: 8 additions & 0 deletions packages/ossa-doc/docs/组件/icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ demo_url: 'https://neteaseyanxuan.github.io/OSSA/#/components/icon/demo/index'
## 介绍
常用图表的集合。

:::tip
按需引入时,如果使用其他包含`Icon`的组件,需要手动引入`Icon`的样式文件

eg:当使用带icon的`Button`时,需要手动引入`Icon`的样式文件

import 'ossaui/dist/style/components/icon.scss'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那这样我们不是要在每一个使用到icon的组件都引入一次?是不是可以增加一个plugin完成这项工作,检测到tsx中有引入icon,就自动引入呢?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

主要是因为Icon的样式文件比较大,如果使用者没有使用到Icon,那引入Icon的样式文件会对包体积不友好,拿Button举例,如果没有使用到带IconButton,其实可以不引入Icon的scss文件。


感觉plugin的想法可行,检测到有带icon属性的OsXXX时,引入icon的样式文件

:::

## 用法
### 基础
```jsx
Expand Down