{"id":20906214,"url":"https://github.com/webpack-config/webpack-config-svg-icon","last_synced_at":"2026-04-20T16:02:26.061Z","repository":{"id":152267630,"uuid":"84987618","full_name":"webpack-config/webpack-config-svg-icon","owner":"webpack-config","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-14T19:12:42.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-19T14:28:37.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpack-config.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-03-14T19:12:06.000Z","updated_at":"2017-03-14T19:12:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"1921d772-4573-41f3-ae45-436b239f11f3","html_url":"https://github.com/webpack-config/webpack-config-svg-icon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-svg-icon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-svg-icon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-svg-icon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-svg-icon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpack-config","download_url":"https://codeload.github.com/webpack-config/webpack-config-svg-icon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243300609,"owners_count":20269258,"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":[],"created_at":"2024-11-18T13:32:30.684Z","updated_at":"2025-12-27T21:04:06.993Z","avatar_url":"https://github.com/webpack-config.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#webpack-config-svg-icon\n\nA config for [Webpack] for loading `.svg` icon files as React components. \n\n[![license](http://img.shields.io/npm/l/webpack-config-svg-icon.svg?style=flat)](https://www.npmjs.com/package/webpack-config-svg-icon)\n[![version](http://img.shields.io/npm/v/webpack-config-svg-icon.svg?style=flat)](https://www.npmjs.com/package/webpack-config-svg-icon)\n[![downloads](http://img.shields.io/npm/dm/webpack-config-svg-icon.svg?style=flat)](https://www.npmjs.com/package/webpack-config-svg-icon)\n\n## Usage\n\nInstall:\n\n```sh\nyarn add webpack-config-svg-icon\n```\n\nAdd to your `webpack.config.babel.js`:\n\n```js\nimport svgIcon from `webpack-config-svg-icon`;\n\nsvgIcon({/* options */})({\n  /* existing webpack configuration */\n})\n```\n\n### Options\n\n|Name|Default|Description|\n|:---|:------|:----------|\n|**`iconPath`**|`asset/icon`|...|\n|**`test`**|`/\\.icon\\.svg$/`|...|\n|**`replaceColor`**|...|...|\n|**`svgo`**|...|...|\n\n## Features\n\n### SVGO\n\nHow to configure SVGO...\n\n### SVG -\u003e React component\n\nSVGs become React components...\n\n### Icon Context\n\nHow to dynamically add icons...\n\n```jsx\nconst context = require.context(process.env.ICON_PATH, false, /\\.icon\\.svg$/);\n```\n\n### Replace fill and stroke with `currentColor`\n\n...\n\n```js\nsvgIcon({replaceColor: /^#(000){1,2}$/})({\n  /* existing webpack configuration */\n})\n```\n\n## Examples\n\n### React `Icon` component\n\nSet up an icon component with display inline-block...\n\n```jsx\n\u003cIcon type='type'/\u003e\n```\n\n[webpack]: https://webpack.github.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack-config%2Fwebpack-config-svg-icon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpack-config%2Fwebpack-config-svg-icon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack-config%2Fwebpack-config-svg-icon/lists"}