react-icons-builder
v1.0.2
Published
react-icons-builder
Downloads
25
Maintainers
Readme
react-icons-builder
build custom react-icons
svg icons collection.
Installation
yarn add -D react-icons-builder
Usage
copy
*.svg
files tosrc/icons
(example path)create a index.js to
src/icons
const path = require('path');
module.exports = {
icons: [
{
id: 'li',
name: 'LocalIcon',
contents: [
{
files: path.resolve(__dirname, './*.svg'),
formatter: (name) => `Li${name}`,
},
],
license: 'MIT',
projectUrl: 'https://li.local',
licenseUrl: 'https://li.local',
},
],
};
- add a script to project package.json
scripts
:
"scripts": {
"build-icons": "react-icons-builder --src ./src/icons --dist ./src/libs/react-icons-ext",
},
yarn build-icons
use for code:
import { RiAbc } from 'react-icons/ri';
import { LiXzy } from '@/libs/react-icons-ext/li'; // `@` aliase src dir
export default () => {
return (
<div>
<RiAbc color="red" />
<LiXzy color="blue" />
</div>
);
};
License
© MIT