Skip to content

Instantly share code, notes, and snippets.

@hj24
Created May 27, 2023 11:50
Show Gist options
  • Save hj24/aa80a22956493c383e803fef4f765de6 to your computer and use it in GitHub Desktop.
Save hj24/aa80a22956493c383e803fef4f765de6 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