Hugo Icons plugin for easy-to-use SVG icons from open-source vendors Lucide and Feather — no bloated layouts.
hicons scans your Hugo layouts for icon usage and automatically generates or updates your icons.html partial with SVGs from Lucide.
🔥 New Workflow: Hicons now has a minimal, night-mode friendly website for Hugo layout-ready code: https://hicons.pages.dev
- ⚡ Auto-detect icons used across Hugo layouts.
- 🧠 Automatically add minified SVGs to your Hugo partials.
- 🧩 Merge icons into your
layouts/partials/icons.htmlor_partials/icons.html. - 🛡 Keeps existing icons safe (no overwrites).
- 🎨 Supports
$classfor Tailwind or custom CSS classes. - 👀 New:
npx hicons --watch & hugo server -Dcan be added to dev scripts for live updates. - 🌐 Dedicated icon website: search, click, and copy layout-ready code instantly.
The refreshed Hicons website embraces a calmer, more minimal interface with full light and dark mode support. Search is instant, copy feedback is clear, and the layout stays focused on the icons you need.
Steps:
- Visit https://hicons.pages.dev
- Use the search bar or the curated tag chips to filter icons (night mode is stored locally between visits)
- Click any icon tile to copy the Hugo-ready partial call instantly
- Paste the code into your Hugo layout template
- Run
npx hicons(or--watchmode) — your Hugo icons partial updates automatically
{{ partial "icons.html" (dict "name" "sparkles" "class" "w-6 h-6 text-pink-500") }}✅ No manual SVG copy. No bloated if-else blocks. Just clean, Hugo-ready code — now in a distraction-free UI.
npm install -g hiconsnpx hicons-
Scans all Hugo layout files:
layouts/**/*.html -
Finds icon partial calls:
{{ partial "icons.html" (dict "name" "mail" "class" "w-6 h-6") }} -
Extracts icon names (e.g.,
mail,heart,sparkles). -
Fetches SVGs from the Lucide library.
-
Updates your Hugo partial (
icons.html), merging new icons while keeping old ones intact.
npx hiconsGenerates/updates icons.html once.
npx hicons --watchOr with Hugo dev server:
npx hicons --watch & hugo server -Dhicons will:
- Watch all
layouts/**/*.htmlfiles - Rebuild the partial whenever icons are added or modified
- Merge new icons safely
- Skip duplicates automatically
Perfect for development with hugo server.
Add this to your package.json:
{
"scripts": {
"dev": "npx hicons --watch & hugo server -D",
"build": "npx hicons && hugo --minify"
}
}Run:
npm run dev- Icons auto-refresh instantly while editing layouts
- Hugo live server reloads automatically
All icons default to:
- 24×24 size
stroke="currentColor"
You can fully customize with Tailwind or custom classes:
{{ partial "icons.html" (dict "name" "heart" "class" "w-8 h-8 text-red-500") }}hicons supports:
layouts/partials/icons.htmllayouts/_partials/icons.html
If neither exists, hicons will automatically create _partials/icons.html.
- Uses Lucide’s official SVG set
- Keeps your existing partial intact
- Merges icons safely
- Prevents duplicates
- Logs new and missing icons clearly
- Persists light/dark preference locally for a consistent browsing experience
| Flag | Description |
|---|---|
--watch |
Watch mode: auto-regenerate icons on layout changes |
--quiet (planned) |
Suppress logs except for errors |
--clean (planned) |
Remove icons no longer used in layouts |
--stats (planned) |
Show how many icons were added or removed |
MIT © OLIMIAH