{"id":20463711,"url":"https://github.com/iconfont-cli/react-iconfont-cli","last_synced_at":"2026-02-27T02:33:39.832Z","repository":{"id":35134033,"uuid":"211046307","full_name":"iconfont-cli/react-iconfont-cli","owner":"iconfont-cli","description":"转换iconfont图标为React标准组件，不依赖字体，支持多色彩","archived":false,"fork":false,"pushed_at":"2024-05-21T03:26:36.000Z","size":252,"stargazers_count":70,"open_issues_count":17,"forks_count":29,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-02T06:12:13.177Z","etag":null,"topics":["icon","iconfont","iconfont-cli","icons","react","react-iconfont"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iconfont-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-26T09:03:07.000Z","updated_at":"2025-08-12T11:01:41.000Z","dependencies_parsed_at":"2024-06-18T16:45:53.907Z","dependency_job_id":"d2d2da1c-d1bd-41bb-accb-1e6f5af4601e","html_url":"https://github.com/iconfont-cli/react-iconfont-cli","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"8300cc518c3d3868a45ab08f06f9f33f68ace8ce"},"previous_names":["fwh1990/react-iconfont-cli"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/iconfont-cli/react-iconfont-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconfont-cli%2Freact-iconfont-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconfont-cli%2Freact-iconfont-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconfont-cli%2Freact-iconfont-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconfont-cli%2Freact-iconfont-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iconfont-cli","download_url":"https://codeload.github.com/iconfont-cli/react-iconfont-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconfont-cli%2Freact-iconfont-cli/sbom","scorecard":{"id":480569,"data":{"date":"2025-08-11","repo":{"name":"github.com/iconfont-cli/react-iconfont-cli","commit":"8300cc518c3d3868a45ab08f06f9f33f68ace8ce"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"16 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T16:30:17.154Z","repository_id":35134033,"created_at":"2025-08-19T16:30:17.154Z","updated_at":"2025-08-19T16:30:17.154Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29883102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["icon","iconfont","iconfont-cli","icons","react","react-iconfont"],"created_at":"2024-11-15T13:12:49.174Z","updated_at":"2026-02-27T02:33:39.799Z","avatar_url":"https://github.com/iconfont-cli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## react-iconfont-cli\n用纯JS把iconfont.cn的图标转换成React组件，不依赖字体，支持多色彩\n\n![](https://github.com/fwh1990/react-iconfont-cli/blob/master/images/icons.png?raw=true)\n\n## 特性\n\n1、纯组件，不依赖字体，体积小\n\u003cbr /\u003e\n2、支持渲染多色彩图标，支持自定义颜色\n\u003cbr /\u003e\n3、自动化生成图标组件，支持es6和typescript两种文件格式\n\n## Step 1\n安装插件\n```bash\n# Yarn\nyarn add react-iconfont-cli --dev\n\n# Npm\nnpm install react-iconfont-cli --save-dev\n```\n\n# Step 2\n生成配置文件\n```bash\nnpx iconfont-init\n```\n此时项目根目录会生成一个`iconfont.json`的文件，内容如下：\n```json\n{\n    \"symbol_url\": \"请参考README.md，复制官网提供的JS链接\",\n    \"use_typescript\": false,\n    \"save_dir\": \"./src/components/iconfont\",\n    \"trim_icon_prefix\": \"icon\",\n    \"unit\": \"px\",\n    \"default_icon_size\": 18\n}\n```\n### 配置参数说明：\n### symbol_url\n请直接复制[iconfont](http://iconfont.cn)官网提供的项目链接。请务必看清是`.js`后缀而不是.css后缀。如果你现在还没有创建iconfont的仓库，那么可以填入这个链接去测试：`http://at.alicdn.com/t/font_1373348_ghk94ooopqr.js`\n\n\u003cbr /\u003e\n\n![](https://github.com/fwh1990/react-iconfont-cli/blob/master/images/symbol-url.png?raw=true)\n\n### use_typescript\n如果您的项目使用Typescript编写，请设置为true。这个选项将决定生成的图标组件是`.tsx`还是`.js`后缀。\n\n当该值为false时，我们会为您的图标生成`.js`和`.d.ts`两个文件，以便您能享受到最好的开发体验。\n\n### save_dir\n根据iconfont图标生成的组件存放的位置。每次生成组件之前，该文件夹都会被清空。\n\n### trim_icon_prefix\n如果你的图标有通用的前缀，而你在使用的时候又不想重复去写，那么可以通过这种配置这个选项把前缀统一去掉。\n\n注意，这个选项只针对 `\u003cIcon /\u003e` 组件有效\n\n### unit\n图标的单位，默认是网页常用单位`px`即像素，也推荐您在手机网页中使用自适应的`rem`单位。\n\n### default_icon_size\n我们将为每个生成的图标组件加入默认的字体大小，当然，你也可以通过传入props的方式改变这个size值。\n\n# Step 3\n开始生成React标准组件\n```bash\nnpx iconfont-h5\n```\n\n生成后查看您设置的保存目录中是否含有所有的图标，你可以参考[snapshots目录](https://github.com/iconfont-cli/react-iconfont-cli/tree/master/snapshots)的快照文件，以区分不同模式下的图标结构。\n\n# 使用\n\n现在我们提供了两种引入方式供您选择：\n\n1、使用汇总`Icon`组件：\n```typescript jsx\nimport React from 'react';\nimport IconFont from '../src/iconfont';\n\nexport const App = () =\u003e {\n  return (\n    \u003cdiv\u003e\n      \u003cIconFont name=\"alipay\" size={20} /\u003e\n      \u003cIconFont name=\"wechat\" /\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n2、使用单个图标。这样可以避免没用到的图标也打包进App：\n\n```typescript jsx\nimport React from 'react';\nimport IconAlipay from '../src/iconfont/IconAlipay';\nimport IconWechat from '../src/iconfont/IconWechat';\n\nexport const App = () =\u003e {\n  return (\n    \u003cdiv\u003e\n      \u003cIconAlipay size={20} /\u003e\n      \u003cIconWechat /\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n### 图标尺寸\n根据配置`default_icon_size`，每个图标都会有一个默认的尺寸，你可以随时覆盖。\n```typescript jsx\n\u003cIconFont name=\"alipay\" size={20} /\u003e\n```\n![](https://github.com/fwh1990/react-iconfont-cli/blob/master/images/default-color-icon.png?raw=true)\n### 图标单色\n单色图标，如果不指定颜色值，图标将渲染原本的颜色。如果你想设置为其他的颜色，那么设置一个你想要的颜色即可。\n\n**注意：如果你在props传入的color是字符串而不是数组，那么即使原本是多色彩的图标，也会变成单色图标。**\n\n```typescript jsx\n\u003cIconFont name=\"alipay\" color=\"green\" /\u003e\n```\n![](https://github.com/fwh1990/react-iconfont-cli/blob/master/images/one-color-icon.png?raw=true)\n\n### 图标多色彩\n多色彩的图标，如果不指定颜色值，图标将渲染原本的多色彩。如果你想设置为其他的颜色，那么设置一组你想要的颜色即可\n```typescript jsx\n\u003cIconFont name=\"alipay\" color={['green', 'orange']} /\u003e\n```\n颜色组的数量以及排序，需要根据当前图标的信息来确定。您需要进入图标组件中查看并得出结论。\n\n\n![](https://github.com/fwh1990/react-iconfont-cli/blob/master/images/multi-color-icon.png?raw=true)\n\n### 与文字并排\n图标是块状的容器，如果您想与文字并排混合，请使用`flex`布局以保证文字和图标能对齐\n```jsx harmony\n\u003cdiv style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}\u003e\n  \u003cspan\u003eHello\u003c/span\u003e\n  \u003cIconFont name=\"alipay\" /\u003e\n\u003c/div\u003e\n```\n\n# 更新图标\n当您在iconfont.cn中的图标有变更时，只需更改配置`symbol_url`，然后再次执行`Step 3`即可生成最新的图标组件\n```bash\n# 修改 symbol_url 配置后执行：\nnpx iconfont-h5\n```\n\n# 扩展\n|平台|库|\n|----|---|\n|小程序|[mini-program-iconfont-cli](https://github.com/iconfont-cli/mini-program-iconfont-cli)|\n|Taro|[taro-iconfont-cli](https://github.com/iconfont-cli/taro-iconfont-cli)|\n|React Native|[react-native-iconfont-cli](https://github.com/iconfont-cli/react-native-iconfont-cli)|\n|Flutter|[flutter-iconfont-cli](https://github.com/iconfont-cli/flutter-iconfont-cli)\n|Remax|[remax-iconfont-cli](https://github.com/iconfont-cli/remax-iconfont-cli)\n\n\n--------\n\n欢迎使用，并给我一些反馈和建议，让这个库做的更好\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficonfont-cli%2Freact-iconfont-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficonfont-cli%2Freact-iconfont-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficonfont-cli%2Freact-iconfont-cli/lists"}