unIcons
A unified icon solution provided by WinJS, using unplugin-icons as the underlying parsing tool. Compatible with multiple build tools such as webpack, rspack, vite, etc., and frontend frameworks such as Vue 2, Vue, etc. The plugin also has built-in Resolver functionality that can automatically import required SVG icons.
Note
Please master the usage of unplugin-icons first.
Setup
- Install the plugin
bash
$ npm add @winner-fed/plugin-unicons -D
bash
$ yarn add @winner-fed/plugin-unicons -D
bash
$ pnpm add @winner-fed/plugin-unicons -D
bash
$ bun add @winner-fed/plugin-unicons -D
- Enable the plugin in the
.winrc
configuration file
ts
import { defineConfig } from 'win';
export default defineConfig({
plugins: [require.resolve('@winner-fed/plugin-unicons')],
unIcons: {
include: [],
// Supports unplugin-icons configuration parameters, such as
customCollections: {
...
}
}
});
Configuration
include
- Type:
Array<string>
- Default:
[]
Used for additional SVG files that need to be parsed using this solution. Note that absolute paths must be used, and they will be compressed by the plugin's built-in svgo.
Supports unplugin-icons Extended Configuration
- Inherits configuration parameters from the unplugin-icons plugin
Note
- When using local icons, according to the naming rules of unplugin-icons, it uses
icon
as the prefix by default andwin
as the collection. It parses SVG icons undersrc/icons
by default, such asicon-win-dog