UNPKG

vue-icon-gallery

Version:

Vite plugin for Vue 3 that opens a local gallery to preview your SVG icons before using them in templates. Instantly browse, search, and view your icons directly from your dev server β€” no more guessing by file name.

118 lines (76 loc) β€’ 2.74 kB
# 🎨 vue-icon-gallery **A Vite plugin for Vue 3 that opens a local gallery to preview your SVG icons before using them in templates.** Perfect for projects where icon names aren’t enough β€” see your icons instantly, browse, search, and copy names without leaving your dev environment. --- ## ✨ Features - πŸ–ΌοΈ **SVG preview gallery** β€” visualize all your icons directly in the browser - πŸ”„ **Auto-updates** β€” new icons appear instantly, no rebuild required - βš™οΈ **Configurable paths & port** β€” preview multiple icon folders - 🚫 **No production impact** β€” runs only during development - 🎨 **Live color testing** β€” try different `fill` / `stroke` colors right in the gallery --- ## 🧩 Preview ![Icon gallery preview](./src/assets/screen.png) --- ## πŸ“¦ Installation ```bash npm i -D vue-icon-gallery ``` --- ## βš™οΈ Usage (vite.config.ts) ```typescript import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { vueIconGallery } from 'vue-icon-gallery' export default defineConfig({ plugins: [ vue(), vueIconGallery({ iconsPath: ['src/components/icons', 'src/assets/svg'], // folders with your SVG files port: 3002, // default: 3002 open: true // default: true (open gallery in browser automatically) }) ] }) ``` Then start your dev server as usual: ```bash npm run dev ``` The plugin will launch a local **SVG gallery server** and print its URL to the console. --- ## 🧠 How it works 1. Scans specified folders for `.vue` files with `<svg>` tags. 2. Serves them via a lightweight local server. 3. Opens a visual gallery page for previewing and copying icon names. --- ## πŸ’‘ Why use this plugin? When you store SVGs as `<template>` components or inline assets, it’s often hard to remember what each one looks like. This plugin solves that β€” you can **see every icon visually before inserting it into code**. --- ## 🧰 Requirements - Vue 3 - Vite 5+ - Node.js 20+ --- ## πŸš€ Roadmap - [ ] Support for React / Svelte projects - [ ] Icon metadata and categorization - [ ] Light theme for gallery - [ ] Inline icon copy option --- ## πŸ“Š Example use cases - Component libraries with large icon sets - Design systems using SVG templates - Teams maintaining internal icon packs --- ## 🧾 License MIT Β© [Egor Maksimov](https://github.com/MaksimovEgor) --- ## πŸ”— Links - πŸ“¦ [NPM Package](https://www.npmjs.com/package/vue-icon-gallery) - πŸ’» [GitHub Repository](https://github.com/MaksimovEgor/vue-icon-gallery) - 🌟 If you like it β€” give it a ⭐ on GitHub! --- ### 🧭 Keywords `vite plugin svg` Β· `vue svg icons` Β· `svg gallery` Β· `vite icon preview` Β· `vue3` Β· `frontend tools`