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

unplugin-iconify-generator

v0.7.3

Published

Automatically generate iconify format json, support Iconify Intellisense

Downloads

286

Readme

:tada: unplugin-iconify-generator

English | 简体中文

Provide DX support for custom icon collections based on the Vscode extension antfu.iconify.

:memo: Usage

To install:

pnpm i -D unplugin-iconify-generator

Provide DX support for customized icons collection

First please install the Vscode extension antfu.iconify.

Thanks to unplugin, unplugin-iconify-generator offers synchronized support for multiple bundlers. For example, with Vite:

import Iconify from 'unplugin-iconify-generator/vite'

import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    Iconify({
      collections: {
        foo: './src/assets/icons'
      }
    }),
  ],
})

According to the config above, assume that you have a icon bar.svg, put it into ./src/assets/icons/:

  • By default, iconify-formatted JSON is generated in the <root>/node_modules/.unplugin-iconify-generator folder by this plugin.
  • Then this plugin will modify .vscode/settings.json to allow antfu.iconify to fetch custom icons. This process is implemented using jsonc-parser, which could preserve comments and maintain the configuration file format.
  • When typing i-foo-bar in the code, you can get corresponding code suggestions and icon thumbnails, where foo is the prefix from the configuration, and bar is the filename of the icon. For more DX-related features, refer to the antfu.iconify documentation.

More details and options, please refer to the Options chapter below.

Normalize svg icons collection

For more details plz refer to source code.

import { type IconifyIcon, parseIcon } from 'unplugin-iconify-generator'
// ...

:wrench: Options

  • iconifyIntelliSense: A boolean value indicating whether to enable support for the antfu.iconify extension. Note that enabling this will modify .vscode/settings.json. Default: true.
  • cwd: An absolute path string specifying the root path, which will be used as the base path for other options. Default: process.cwd().
  • output: A path string indicating where the generated metadata will be stored. Default: './node_modules/.unplugin-iconify-generator'.
  • collections: A required object where the key is a string representing the icon set prefix, and the value is a path string pointing to a folder. All .svg files within that folder will be considered as icons belonging to the specified icon set.
{
  collections: {
    foo: './src/assets/icons'
  }
}

Assume you have a icon './src/assets/icons/bar.svg', you can use it like: i-foo-bar