1.0.0 โ€ข Published 5 months ago

@rustkas/svelte-heroicons v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

svelte-heroicons

Minimal, modern and fully typed Heroicons integration for SvelteKit.
Tree-shakable, CLI-powered, and zero dependencies.

npm version GitHub stars


โœจ Features

  • โšก Tree-shakable ES module exports per style & size
  • ๐Ÿ“ฆ Auto-generated from official Heroicons SVGs
  • ๐Ÿง  Type-safe with full TypeScript support
  • ๐Ÿ›  CLI generator with --only, --style, --icon, --dry-run
  • ๐ŸŽ› Import only what you need: import { XMarkIcon } from 'svelte-heroicons/solid-24'
  • ๐Ÿงช Includes npm run validate sandbox test

Icons are based on Heroicons, licensed under MIT by Tailwind Labs.

Minimal and tree-shakeable Heroicons for SvelteKit โ€” written from scratch with zero dependencies.

This project is based on the official MIT-licensed Heroicons by Tailwind Labs.

๐Ÿ“ฆ Installation

npm install svelte-heroicons

๐Ÿš€ Quick Start

npm install svelte-heroicons
<script lang="ts">
  import { AcademicCapIcon } from 'svelte-heroicons/outline-24';
</script>

<AcademicCapIcon class="w-6 h-6 text-blue-500" />

๐Ÿ“ Exports

Available submodules:

svelte-heroicons/outline-24
svelte-heroicons/solid-20
svelte-heroicons/solid-16
...

Usage

<script lang="ts">
  import { HomeIcon } from 'svelte-heroicons/solid';
</script>

<HomeIcon class="w-6 h-6 text-blue-500" />

๐ŸŽ› CLI Usage (for maintainers)

npm run generate -- --only=24 --style=outline
npm run generate -- --icon=academic-cap,x-mark
npm run generate -- --dry-run

How to clone

git clone https://github.com/rustkas/svelte-heroicons.git
cd svelte-heroicons
git submodule update --init --recursive

๐ŸŽ› Generator Flags

You can pass additional CLI arguments to control generation:

FlagDescriptionExample
--only=24Only generate icons of size 24--only=24
--style=outlineOnly include a specific style (solid, outline)--style=solid
--icon=x-markGenerate only specific icons (comma-separated)--icon=academic-cap,x-mark
--dry-runDon't write files โ€” just simulate and log--dry-run

Examples

npm run generate -- --only=24 --style=solid
npm run generate -- --icon=academic-cap,x-mark
npm run generate -- --dry-run

๐Ÿงช Package Validation

To test your package end-to-end:

npm run validate

This will:

  • Generate icons
  • Build the package with svelte-package
  • Pack it into a .tgz archive
  • Install it into a temporary validate-playground project
  • Run a minimal import test
  • Automatically remove the test folder

๐Ÿ“ Update Heroicons (Submodule)

To update the SVG source files from upstream:

git submodule update --remote --merge