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

svg文件使用什么工具导出的 #599

Open
hec9527 opened this issue Sep 19, 2023 · 3 comments
Open

svg文件使用什么工具导出的 #599

hec9527 opened this issue Sep 19, 2023 · 3 comments

Comments

@hec9527
Copy link

hec9527 commented Sep 19, 2023

我们使用 sketch 导出svg文件,里面包含了大量无用的title, g, defs。即便很多时候根本不要defs,生成的文件依然包含大量的defs和g,这在使用的使用会导致defs中的id重复。

如何才能导出像 ant-design-icons 里面的svg一样干净、简洁

@iamzhanghao
Copy link

@hec9527
Copy link
Author

hec9527 commented Sep 21, 2023

我也用svgo了,但是产物也没有antd这样赶紧,有很多嵌套的g和没必要的def

@iamzhanghao
Copy link

iamzhanghao commented Sep 27, 2023

Antd 用了这些options
https://github.com/ant-design/ant-design-icons/blob/master/packages/icons-svg/plugins/svgo/presets/base.ts

你可能是没有把这个打开

{ removeUselessDefs: true },
{ moveElemsAttrsToGroup: true },
{ moveGroupAttrsToElems: true },
{ collapseGroups: true },

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

No branches or pull requests

2 participants