Skip to content

unIcons

NPM Version

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

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

Note

  • When using local icons, according to the naming rules of unplugin-icons, it uses icon as the prefix by default and win as the collection. It parses SVG icons under src/icons by default, such as icon-win-dog

Released under the MIT License.