mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 10:12:11 +00:00
Enhanced custom icon support with tailwind (#5159)
* Add support for custom iconify using tailwind plugin - Register svgs from custom icons folder - Update existing custom icons to remove padding - Swap component icons for classes in sidebar tabs - Update browse templates in menu to use custom icon * Add basic check for custom SVG icons * Remove unused iconify packages
This commit is contained in:
29
build/customIconCollection.js
Normal file
29
build/customIconCollection.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { readFileSync, readdirSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { dirname } from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const fileName = fileURLToPath(import.meta.url)
|
||||
const dirName = dirname(fileName)
|
||||
const customIconsPath = join(dirName, '..', 'src', 'assets', 'icons', 'custom')
|
||||
|
||||
// Create an Iconify collection for custom icons
|
||||
export const iconCollection = {
|
||||
prefix: 'comfy',
|
||||
icons: {},
|
||||
width: 16,
|
||||
height: 16
|
||||
}
|
||||
|
||||
// Read all SVG files from the custom icons directory
|
||||
const files = readdirSync(customIconsPath)
|
||||
files.forEach((file) => {
|
||||
if (file.endsWith('.svg')) {
|
||||
const name = file.replace('.svg', '')
|
||||
const content = readFileSync(join(customIconsPath, file), 'utf-8')
|
||||
|
||||
iconCollection.icons[name] = {
|
||||
body: content
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user