A tool to generate a subset of React icons from react-icons, including only the specific icons you use in your project.
npm install --save-dev react-icons-gen
# or
yarn add --dev react-icons-gen
# or
pnpm add --save-dev react-icons-gen- Create a manifest file in TOML format that defines which icons you want to include
- Run the tool with the manifest file as an argument
npx react-icons-gen manifest.tomlThe manifest file is a TOML file that defines which icons you want to include and where to output them.
[[entry]]: Defines an entry in the manifest (you can have multiple entries)file: The output file where the generated icons will be writtenicons: An array of icons to include, in the format"module:IconName"- Example:
"react-icons/fa:FaTrash"includes theFaTrashicon from thereact-icons/famodule
- Example:
[[entry]]
file = "src/icons.ts"
icons = [
"react-icons/fa:FaTrash",
"react-icons/fa:FaCaretDown",
"react-icons/fa:FaCopy",
]The generated icons accept all standard SVG attributes plus:
size: Sets both width and height (default: "1em")title: Adds a title to the SVG for accessibility
MIT