@plugin-svg-types/rsbuild
v0.0.3
Published
🎯 Core Functionality plugin-svg-types is an automation plugin designed to address the issue of lack of type safety for icon names when utilizing SVG icons in a project.
Readme
@plugin-svg-types/rsbuild
🎯 Core Functionality plugin-svg-types is an automation plugin designed to address the issue of lack of type safety for icon names when utilizing SVG icons in a project.
It scans a designated directory for all .svg files and automatically generates a TypeScript Union Type (SvgIconName) based on those filenames (stripped of the .svg extension). This resulting union type is then exported to a type declaration file (.d.ts).
Usage
Install:
npm add @plugin-svg-types/rsbuild -DAdd plugin to your rsbuild.config.ts:
// rsbuild.config.ts
import { pluginSvgTypes } from "@plugin-svg-types/rsbuild";
export default {
plugins: [pluginSvgTypes()],
};Options
License
MIT.
