1.0.0 โข Published 5 months ago
@rustkas/svelte-heroicons v1.0.0
svelte-heroicons
Minimal, modern and fully typed Heroicons integration for SvelteKit.
Tree-shakable, CLI-powered, and zero dependencies.
โจ 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 validatesandbox 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-runHow 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:
| Flag | Description | Example |
|---|---|---|
--only=24 | Only generate icons of size 24 | --only=24 |
--style=outline | Only include a specific style (solid, outline) | --style=solid |
--icon=x-mark | Generate only specific icons (comma-separated) | --icon=academic-cap,x-mark |
--dry-run | Don'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 validateThis will:
- Generate icons
- Build the package with
svelte-package - Pack it into a
.tgzarchive - Install it into a temporary
validate-playgroundproject - Run a minimal
importtest - Automatically remove the test folder
๐ Update Heroicons (Submodule)
To update the SVG source files from upstream:
git submodule update --remote --merge1.0.0
5 months ago