{"id":13495681,"url":"https://github.com/MoOx/react-from-svg","last_synced_at":"2025-03-28T16:33:10.648Z","repository":{"id":34553399,"uuid":"180083317","full_name":"MoOx/react-from-svg","owner":"MoOx","description":"Transform SVG files into React components (native | web, JavaScript | Reason/ReScript).","archived":false,"fork":false,"pushed_at":"2023-01-17T17:18:46.000Z","size":521,"stargazers_count":60,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T04:12:30.375Z","etag":null,"topics":["react","react-native","react-native-svg","reactjs","reason-react-native","reasonml","svg"],"latest_commit_sha":null,"homepage":"","language":"ReScript","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/MoOx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-08T06:23:25.000Z","updated_at":"2023-07-28T09:19:22.000Z","dependencies_parsed_at":"2023-02-10T10:50:18.602Z","dependency_job_id":null,"html_url":"https://github.com/MoOx/react-from-svg","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freact-from-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freact-from-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freact-from-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freact-from-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MoOx","download_url":"https://codeload.github.com/MoOx/react-from-svg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246063181,"owners_count":20717761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["react","react-native","react-native-svg","reactjs","reason-react-native","reasonml","svg"],"created_at":"2024-07-31T19:01:37.094Z","updated_at":"2025-03-28T16:33:10.329Z","avatar_url":"https://github.com/MoOx.png","language":"ReScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# React from SVG\n\n\u003ca href=\"https://github.com/MoOx/react-from-svg?sponsor=1\"\u003e\n  \u003cimg width=\"140\" align=\"right\" alt=\"Sponsoring button\" src=\"https://github.com/moox/.github/raw/main/FUNDING.svg\"\u003e\n\u003c/a\u003e\n\n[![GitHub package.json version](https://img.shields.io/github/package-json/v/MoOx/react-from-svg) ![npm downloads](https://img.shields.io/npm/dm/react-from-svg)](https://www.npmjs.com/package/react-from-svg)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/MoOx/react-from-svg/build.yml?branch=main)](https://github.com/MoOx/react-from-svg/actions)\n[![License](https://img.shields.io/github/license/MoOx/react-from-svg)](https://github.com/MoOx/react-from-svg)  \n[![GitHub followers](https://img.shields.io/github/followers/MoOx?style=social\u0026label=Follow%20me)](https://github.com/MoOx)\n[![Twitter Follow](https://img.shields.io/twitter/follow/MoOx?style=social\u0026label=Follow%20me)](https://twitter.com/MoOx)\n[![Sponsor my work](https://github.com/moox/.github/raw/main/FUNDING-button.svg)](https://github.com/MoOx/react-from-svg?sponsor=1)\n\n\u003e Transform SVG files into React components, Native and/or Web, JavaScript and\n\u003e rescriptML. Without shitload of dependencies.\n\n## Install\n\n```console\nnpm install react-from-svg\n\n# or\n\nyarn add react-from-svg\n```\n\n## Usage\n\n```console\nreact-from-svg --help\n\nUsage\n  $ react-from-svg \u003csourcePath\u003e \u003coutputPath\u003e [--with-native|--with-web]\n\nOptions\n  --with-native, -rn                    Output code for react-native-svg\n  --with-native-for-typescript, -rnts   Output code for react-native-svg with TypeScript\n\n  --with-web, -rnw                      Output code for DOM. If --with-native is also used, will be output as .web.js files\n  --with-native-for-rescript, -rrn      Output code for @rescript-react-native/svg\n  --with-web-for-rescript, -rrnw        Output code for @rescript/react\n  --remove-fill, -rf                    Remove all 'fill' properties from SVGs, convenient for icons\n  --remove-stroke, -rs                  Remove all 'stroke' properties from SVGs, convenient for icons\n  --commonjs, -cjs                      Export as commonjs instead of es6 import/export\n\nExample\n  $ react-from-svg assets/svgs src/Svgs --with-native --remove-fill\n```\n\nGenerated components will have the following props that you can inject to the\nSVG components:\n\n- `width`\n- `height`\n- `fill` (if you use `--remove-fill`)\n- `stroke` (if you use `--remove-stroke`)\n\n⚠️ To see what you can expect from the transformations,\n[check our snapshots](./__tests__/__snapshots__) 👀\n\n## Requirements\n\n### `--with-web`\n\nNeed you to have:\n\n- [React](https://reactjs.org)\n\n### `--with-web-for-rescript`\n\nNeed you to have:\n\n- [React](https://reactjs.org)\n- [`rescript-react`](https://rescriptml.github.io/rescript-react/)\n\n### `--with-native`\n\nNeed you to have:\n\n- [React](https://reactjs.org)\n- [React Native](https://reactnative.dev) (or an alternative platform like\n  [React Native Web](https://github.com/necolas/react-native-web))\n- [`react-native-svg`](https://github.com/react-native-community/react-native-svg)\n\n### `--with-native-for-rescript`\n\nIn addition to `--with-native` requirements, you need to have:\n\n- [`@rescript/react`](https://rescript-lang.org/docs/react/latest/introduction)\n- [`rescript-react-native`](https://rescript-react-native.github.io)\n- [`@rescript-react-native/svg`](https://github.com/rescript-react-native/svg)\n\nEnsure as that this dependencies are in the `bs-dependencies` of your `bsconfig.json`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMoOx%2Freact-from-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMoOx%2Freact-from-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMoOx%2Freact-from-svg/lists"}