Naked Panda Meditations

    react-icons-builder

    1.0.1 • Public • Published

    react-icons-builder

    build custom react-icons svg icons collection.

    Installation

    yarn add -D react-icons-builder

    Usage

    1. copy *.svg files to src/icons (example path)

    2. 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',
        },
      ],
    };
    1. add a script to project package.json scripts:
    "scripts": {
      "build-icons": "react-icons-builder --src ./src/icons --dist ./src/libs/react-icons-ext",
    },
    
    1. yarn build-icons

    2. 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

    Install

    npm i react-icons-builder

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    15.1 kB

    Total Files

    12

    Last publish

    Collaborators

    • solidzoro