mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
feat: migrate from @iconify/tailwind to @iconify/tailwind4 (#8724)
## Summary Migrate from `@iconify/tailwind` (Tailwind 3 JS plugin) to `@iconify/tailwind4` (native Tailwind 4 CSS plugin), moving all config into CSS directives. ## Changes - **What**: Replace `addDynamicIconSelectors()` JS plugin with `@plugin "@iconify/tailwind4"` CSS directive. Move `boxShadow` theme extension into `@theme` block. Delete both `tailwind.config.ts` files and the runtime `iconCollection.ts` module. - **Dependencies**: `@iconify/tailwind` removed, `@iconify/tailwind4` added ## Review Focus - `from-folder` path resolution in monorepo context (paths relative to project root) - SVG auto-cleanup behavior of `from-folder` vs the previous manual `iconCollection.ts` loader - Removal of `@config` directive and both tailwind config files — all config now in CSS ## Files | File | Change | |------|--------| | `pnpm-workspace.yaml` | Swap catalog entry | | `packages/design-system/package.json` | Swap dep, remove `tailwind-config` export | | `packages/design-system/src/css/style.css` | Add `@plugin`, `--shadow-interface` theme token, remove `@config` | | `packages/design-system/tailwind.config.ts` | Deleted | | `packages/design-system/src/iconCollection.ts` | Deleted | | `tailwind.config.ts` | Deleted | | `tsconfig.json`, `components.json` | Remove stale references | | `knip.config.ts` | Ignore `@iconify-json/lucide` (CSS-consumed, not JS-imported) | | Docs | Updated `CONTRIBUTING.md` and `icons/README.md` | ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8724-feat-migrate-from-iconify-tailwind-to-iconify-tailwind4-3006d73d36508144a9b3e7ae73448f98) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -251,26 +251,25 @@ Icons are automatically imported using `unplugin-icons` - no manual imports need
|
||||
|
||||
The icon system has two layers:
|
||||
|
||||
1. **Build-time Processing** (`packages/design-system/src/iconCollection.ts`):
|
||||
- Scans `packages/design-system/src/icons/` for SVG files
|
||||
- Validates SVG content and structure
|
||||
- Creates Iconify collection for Tailwind CSS
|
||||
- Provides error handling for malformed files
|
||||
1. **Tailwind CSS Plugin** (`@iconify/tailwind4`):
|
||||
- Configured via `@plugin` directive in `packages/design-system/src/css/style.css`
|
||||
- Uses `from-folder(comfy, ...)` to load SVGs from `packages/design-system/src/icons/`
|
||||
- Auto-cleans and optimizes SVGs at build time
|
||||
|
||||
2. **Vite Runtime** (`vite.config.mts`):
|
||||
- Enables direct SVG import as Vue components
|
||||
- Supports dynamic icon loading
|
||||
|
||||
```typescript
|
||||
// Build script creates Iconify collection
|
||||
export const iconCollection: IconifyCollection = {
|
||||
prefix: 'comfy',
|
||||
icons: {
|
||||
workflow: { body: '<svg>...</svg>' },
|
||||
node: { body: '<svg>...</svg>' }
|
||||
}
|
||||
```css
|
||||
/* CSS configuration for Tailwind icon classes */
|
||||
@plugin "@iconify/tailwind4" {
|
||||
prefix: 'icon';
|
||||
scale: 1.2;
|
||||
icon-sets: from-folder(comfy, './packages/design-system/src/icons');
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
// Vite configuration for component-based usage
|
||||
Icons({
|
||||
compiler: 'vue3',
|
||||
|
||||
Reference in New Issue
Block a user