Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save morristech/fc9bb799e037f4212d3a22224efcf129 to your computer and use it in GitHub Desktop.
Save morristech/fc9bb799e037f4212d3a22224efcf129 to your computer and use it in GitHub Desktop.

How to

  1. yarn add --dev @svgr/cli
  2. Config in package.json
"scripts": {
    "svgr": "npx @svgr/cli --out-dir src/components/icons --ignore-existing -- src/assests/icons"
}
  1. yarn svgr
  2. Use with semi-ui
import {Divider, Icon, Typography} from '@douyinfe/semi-ui';
import SvgBulleye from './components/icons/Bulleye';

<Icon svg={<SvgBulleye />} />

Reference

  1. https://react-svgr.com/docs/cli/
  2. https://semi.design/zh-CN/basic/icon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment