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

@wujifa/icons-library

v0.0.4

Published

A icons library starter

Downloads

3

Readme

English | 中文

Intro

A starter template for building an icon library.

Features

  • 📦 Supports svg transform to vue3, react components and esm, cjs modules
  • 📦 Supports svg conversion to web fonts
  • 📦 Supports icon components automatic import
  • 📦 Supports icon preview site
  • 📦 Supports fetching all svg files from figma design file
  • 📦 Provide release related tools, supports npm, github release and changelog generation

Preview Site

https://varletjs.github.io/varlet-icons-library-starter

Icons Usage

Web font icons

import '<packageName>/svg-fonts/css/i-icons.css'
<i class="i i-account-circle-outline"></i>
<i class="i i-account-circle-outline" style="color: red; font-size: 30px"></i>

Vue Component

<script setup>
import { XIcon, AccountCircleOutline } from '<packageName>'
</script>

<template>
  <x-icon>
    <account-circle-outline />
  </x-icon>
   
  <x-icon color="red" :size="30">
    <account-circle-outline />
  </x-icon>
</template>

React Component

import { XIcon, AccountCircleOutline } from '<packageName>'

function Demo() {
  return <>
    <XIcon>
      <AccountCircleOutline />
    </XIcon>
   
    <XIcon color="red" size={30}>
      <AccountCircleOutline />
    </XIcon>
  </>
}

Automatic import component

When we generate icon components, we will also generate a resolver for unplugin-vue-components, which can be used to automatically import icon components. Here we take vite with vue component as an example。

// vite.config.ts
import components from 'unplugin-vue-components/vite'
import XIconResolver from '<packageName>/resolver'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    components({
      resolvers: [XIconResolver()]
    })
  ]
})
<template>
  <x-icon>
    <x-account-circle-outline />
  </x-icon>
   
  <x-icon color="red" :size="30">
    <x-account-circle-outline />
  </x-icon>
</template>

Framework Support

We support Vue3 and React, and compile components to Vue3 by default. If you want to generate React components, refer to the following configuration.

// vi.config.ts
import { defineConfig } from '@varlet/icon-builder'

export default defineConfig({
  name: 'i-icons',
  namespace: 'i',
  fontFamilyClassName: 'i',
  output: './svg-fonts'
+ generate: {
+   framework: 'react'
+ }  
})
// package.json
{
  "peerDependencies": {
    "unplugin-vue-components": "^0.27.0",
-   "vue": "^3.4.29",
+   "react": "^18.3.1" 
  },
}

Get svg icons from figma documents

We support getting svg icons from figma documents. The specific implementation steps are as follows.

Step 1

Create a figma document with the page name Icons and get the file id.

Step 2

Get figma access token.

See here

Step 3

Set token and file id into script.(For the security of token, it is recommended to set the token to the ci environment variable)

// package.json
"scripts": {
- "icons:figma": "VI_FIGMA_TOKEN=123456 vi figma -f 123456",
+ "icons:figma": "VI_FIGMA_TOKEN=<token> vi figma -f <fileId>",
}

figma webhook

If you want to automatically build the icon library when the designer updates the figma icon library, you can mount figma's webhook, which can fully open up the automated workflow of designers and front-end developers. For more information, see figma webhook.

Core Commands

Run icon preview site development

pnpm dev

Build icon preview site

pnpm build

Run icon preview site preview mode

pnpm preview

Build icon web fonts

pnpm icons:build

Generate icon component and esm, cjs modules

pnpm icons:generate

Fetch all svg files from figma file

pnpm icons:figma

Release icon library

pnpm release

Configuration Reference

See here

Community

We recommend that issue be used for problem feedback, or others:

  • Wechat group

Thanks to contributors

Thanks to the following sponsors

Sponsor this project

Sponsor this project to support our better creation.

Wechat / Alipay