npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@waset/unplugin-iconify

v1.3.0

Published

[![NPM version](https://img.shields.io/npm/v/@waset/unplugin-iconify?color=blue)](https://www.npmjs.com/package/@waset/unplugin-iconify)

Downloads

1,171

Readme

unplugin-iconify

NPM version

安装

pnpm i -D @waset/unplugin-iconify

使用

Iconify({
  /**
   * 工作区路径
   * @description 项目根目录
   * @default process.cwd()
   */
  workspace: cwd(),
  /**
   * 图标转换配置
   */
  convert: {
    // 直接导出目录
    svg: 'assets/icons',
    // 不导出颜色
    icon: {
      path: 'assets/icons',
      noColor: true,
    },
    // 不导出颜色且添加后缀
    suffix: {
      path: 'assets/icons',
      noColor: true,
      suffix: 'color',
    },
  },

  /**
   * 输出目录
   * @type string
   * @default `path.join(process.cwd(), 'node_modules/.unplugin-iconify')`
   */
  output: 'dist/icons',

  /**
   * 是否适配 VSCode 插件 Iconify IntelliSense
   * @type boolean | string
   * @default false
   */
  iconifyIntelliSense: true,
})

补充

用例

参照上述 convert 配置,如果拥有 assets/icons/cat.svg,将会生成以下 iconify 图标

  • icon-cat icon:cat i-icon-cat
  • svg-cat svg:cat i-svg-cat
  • suffix-cat-color suffix:cat-color i-suffix-cat-color

配置

// vite.config.ts
import Iconify from '@waset/unplugin-iconify/vite'

export default defineConfig({
  plugins: [
    Iconify({
      // ...
    })
  ],
})
// nuxt.config.ts
import { defineNuxtConfig } from 'nuxt/config'

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  modules: [
    // ...
    '@waset/unplugin-iconify/nuxt'
  ],
  Iconify: {
    // ...
  },
})
// uno.config.ts
import { UnocssLoader } from '@waset/unplugin-iconify/loader'
import { defineConfig, presetIcons } from 'unocss'

export default defineConfig({
  presets: [
    // ...
    presetIcons({
      scale: 1.2,
      warn: true,
      extraProperties: {
        'display': 'inline-block',
        'vertical-align': 'middle',
      },
      collections: {
        ...UnocssLoader(/** output */),
      },
    }),
  ],
  // ...
})

感谢