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

@varlet/icon-builder

v0.5.1

Published

icon builder of varlet

Downloads

776

Readme

Intro

@varlet/icon-builder is a tool to build svg images to icon fonts.

Installation

npm

npm i @varlet/icon-builder -D

yarn

yarn add @varlet/icon-builder -D

pnpm

pnpm add @varlet/icon-builder -D

Usage

Commands

build

Build svg into icon font.

npx vi build

# watch mode
npx vi build -w

generate

Generate components from svg, support esm, cjs, sfc, types.

npx vi generate

figma

Pull the svg icon in the figma document to the local.

npx vi figma -f <file> -t <token>
#or token from process.env
VI_FIGMA_TOKEN=<token> npx vi figma -f <file>

Configuration File

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

export default defineConfig({
  name: 'i-icons',
  namespace: 'i',
  fontFamilyClassName: 'i--set',
  entry: './svg-icons',
  output: './icons',
  figma: {},
  generate: {}
})

Configuration Type Declaration

export interface VIConfig {
  /**
   * @default `varlet-icons`
   * font name.
   */
  name?: string
  /**
   * @default `var-icon`
   * font name prefix.
   */
  namespace?: string
  /**
   * @default `true`
   * output base64
   */
  base64?: boolean
  /**
   * @default `./svg`
   * svg icons folder path.
   */
  entry?: string
  /**
   * @default `./dist`
   * svg icons folder path.
   */
  output?: string
  /**
   * @default `var-icon--set`
   * icon font family class name.
   */
  fontFamilyClassName?: string
  /**
   * @default `normal`
   * icon font weight.
   */
  fontWeight?: string
  /**
   * @default `normal`
   * icon font style.
   */
  fontStyle?: string
  /**
   * @default `false`
   * Whether to output files
   */
  emitFile?: boolean
  /**
   * icon font public path
   */
  publicPath?: string
   /**
   * icon font public url
   */
  publicURL?: string
  /**
   * icon filenames, e.g. ['window-close', 'cog']
   */
  filenames?: string[]
  /**
   * generate command related options
   */ 
  generate?: {
    /**
     * @default `./svg`
     * svg icons folder path
     */
    entry?: string
    /**
     * @default `XIcon`
     * wrapper component name, svg file names should avoid using names like x-icon.svg
     */
    wrapperComponentName?: string
    /**
     * @default `x`
     * unplugin-vue-components resolver namespace, please same as `wrapperComponentName` namespace
     */
    resolverNamespace?: string
    /**
     * @default `vue3`
     * frameworks supported by the icon library
     */
    framework?: 'vue3' | 'react'
    /**
     * @default `false`
     * only generate components, do not generate cjs, esm modules and types
     */
    componentsOnly?: boolean
    output?: {
      /**
       * @default `./svg-components`
       * component output path
       */
      component?: string
      /**
       * @default `./svg-types`
       * ts declaration output path
       */
      types?: string
      /**
       * @default `./svg-esm`
       * es module format output path
       */
      esm?: string
      /**
       * @default `./svg-cjs`
       * commonjs module format output path
       */
      cjs?: string
      /**
       * @default `./resolver`
       * unplugin-vue-components resolver output path
       */
      resolver?: string
    }
  }
  /**
   * figma parsing options
   */
  figma?: {
    /**
     * figma token
     * @see https://www.figma.com/developers/api#authentication
     */
    token?: string
    /**
     * figma file id
     */
    file?: string
    /**
     * @default `Icons`
     * figma icons page name
     */
    pageName?: string
    /**
     * @default `false`
     * whether to skip downloading svg files when a file with the same name exists locally
     */
    skipExisting?: boolean
    /**
     * @default `false`
     * whether to clear the output directory before downloading
     */
    clean?: boolean
    /**
     * @default `./svg-figma`
     * output path
     */
    output?: string
  }
}