diff --git a/app/utils/file-icons.ts b/app/utils/file-icons.ts index 6647e43a0e..e0220a0f99 100644 --- a/app/utils/file-icons.ts +++ b/app/utils/file-icons.ts @@ -264,12 +264,12 @@ export const FILENAME_ICONS: Record = { 'CONTRIBUTING.md': 'vscode-icons-file-type-markdown', 'contributing.md': 'vscode-icons-file-type-markdown', 'CODE_OF_CONDUCT.md': 'vscode-icons-file-type-markdown', - 'LICENSE': 'vscode-icons-file-type-license', - 'LICENSE.md': 'vscode-icons-file-type-license', - 'LICENSE.txt': 'vscode-icons-file-type-license', - 'license': 'vscode-icons-file-type-license', - 'license.md': 'vscode-icons-file-type-license', - 'license.txt': 'vscode-icons-file-type-license', + 'LICENSE': 'custom-license-minified', + 'LICENSE.md': 'custom-license-minified', + 'LICENSE.txt': 'custom-license-minified', + 'license': 'custom-license-minified', + 'license.md': 'custom-license-minified', + 'license.txt': 'custom-license-minified', // Node '.npmrc': 'vscode-icons-file-type-npm', diff --git a/assets/media/custom-icons.json b/assets/media/custom-icons.json new file mode 100644 index 0000000000..53f540db9c --- /dev/null +++ b/assets/media/custom-icons.json @@ -0,0 +1,27 @@ +{ + "agent-skills": { + "body": "", + "width": 32, + "height": 32 + }, + "tangled": { + "body": "", + "width": 25, + "height": 25 + }, + "vlt": { + "body": "", + "width": 24, + "height": 24 + }, + "a11y": { + "body": "", + "width": 24, + "height": 24 + }, + "license-minified": { + "body": "", + "width": 32, + "height": 32 + } +} diff --git a/scripts/generate-file-tree-sprite.ts b/scripts/generate-file-tree-sprite.ts index ac691de737..29bf2d615e 100644 --- a/scripts/generate-file-tree-sprite.ts +++ b/scripts/generate-file-tree-sprite.ts @@ -10,19 +10,22 @@ import { COMPOUND_EXTENSIONS, DEFAULT_ICON, } from '../app/utils/file-icons.ts' +import customIcons from '../assets/media/custom-icons.json' with { type: 'json' } const rootDir = process.cwd() -const outputDevPath = path.join(rootDir, 'public', 'file-tree-sprite.svg') -const outputStagePath = path.join(rootDir, 'public-dev', 'file-tree-sprite.svg') -const outputProdPath = path.join(rootDir, 'public-prod', 'file-tree-sprite.svg') +const outputDevPath = path.join(rootDir, 'public-dev', 'file-tree-sprite.svg') +const outputStagePath = path.join(rootDir, 'public-staging', 'file-tree-sprite.svg') +const outputProdPath = path.join(rootDir, 'public', 'file-tree-sprite.svg') -const COLLECTION_NAMES = ['lucide', 'simple-icons', 'svg-spinners', 'vscode-icons'] +const ICONIFY_COLLECTION_NAMES = ['lucide', 'simple-icons', 'svg-spinners', 'vscode-icons'] -const COLLECTION_REGEXP = new RegExp(`^(${COLLECTION_NAMES.join('|')})-(.+)$`) +const COLLECTION_REGEXP = new RegExp(`^(${ICONIFY_COLLECTION_NAMES.join('|')}|custom)-(.+)$`) async function loadCollections() { - const collections: { [key: string]: IconifyJSON } = {} - for (const name of COLLECTION_NAMES) { + const collections: { [key: string]: IconifyJSON } = { + custom: { icons: customIcons, prefix: 'custom' }, + } + for (const name of ICONIFY_COLLECTION_NAMES) { const filePathUrl = import.meta.resolve(`@iconify-json/${name}/icons.json`) const filePath = fileURLToPath(filePathUrl) const raw = await fs.readFile(filePath, 'utf8') diff --git a/uno.config.ts b/uno.config.ts index ddbbafb7a0..665f2fc850 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -10,17 +10,7 @@ import { import { presetRtl } from './uno-preset-rtl' import { presetA11y } from './uno-preset-a11y' import { theme } from './uno.theme' - -const customIcons = { - 'agent-skills': - '', - 'tangled': - '', - 'vlt': - '', - 'a11y': - '', -} +import customIcons from './assets/media/custom-icons.json' export default defineConfig({ // og-image uses hardcoded classes we don't want bundled into main app @@ -45,7 +35,9 @@ export default defineConfig({ warn: true, scale: 1.2, collections: { - custom: customIcons, + custom: Object.fromEntries( + Object.entries(customIcons).map(([key, { body }]) => [key, body]), + ), }, }), presetTypography(),