ae66c2e34c
Add 50,000+ icon font package sourced from Flaticon API with local webfonts and interactive icon explorer. Features: - 50,492 icons across 15 style variations (weight × corner) - Self-hosted webfonts (TTF, WOFF, WOFF2) - Interactive icon explorer with search and filters - FontForge-based build pipeline for generating fonts from SVGs - Drop-in CSS with class-based icon usage Build scripts: - scripts/build-font.py - Standalone FontForge Python script - build-fonts.js - Node.js orchestrator for font generation - update-icon-list.js - Fetch icon metadata from Flaticon API - build-icons-js.js - Generate browser-ready icon dataset Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Co-Authored-By: Z.ai GLM 4.7 <noreply@z.ai>
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
const fs = require('fs');
|
|
|
|
// Read API data
|
|
const allIcons = JSON.parse(fs.readFileSync('data/all_icons.json', 'utf8'));
|
|
|
|
// Read CDN availability
|
|
const cdnIcons = {};
|
|
const prefixes = ['rs', 'rr', 'bs', 'br', 'ss', 'sr', 'ts', 'tr', 'brands'];
|
|
|
|
prefixes.forEach(prefix => {
|
|
const content = fs.readFileSync(`/tmp/cdn-${prefix}.txt`, 'utf8');
|
|
cdnIcons[prefix] = new Set(content.trim().split('\n').filter(Boolean));
|
|
});
|
|
|
|
// Group icons by name
|
|
const iconsByName = {};
|
|
allIcons.forEach(icon => {
|
|
if (!iconsByName[icon.name]) {
|
|
iconsByName[icon.name] = {
|
|
name: icon.name,
|
|
isBrand: icon.is_brand,
|
|
tags: icon.tags,
|
|
variants: {}
|
|
};
|
|
}
|
|
iconsByName[icon.name].variants[icon.prefix] = {
|
|
id: icon.id,
|
|
svg: icon.svg,
|
|
inCdn: cdnIcons[icon.prefix]?.has(icon.name) || false
|
|
};
|
|
});
|
|
|
|
// Create output
|
|
const output = {
|
|
icons: Object.values(iconsByName),
|
|
stats: {
|
|
totalIcons: Object.keys(iconsByName).length,
|
|
totalVariants: allIcons.length,
|
|
cdnAvailable: {},
|
|
apiTotal: {}
|
|
},
|
|
cdnIcons: {}
|
|
};
|
|
|
|
prefixes.forEach(prefix => {
|
|
output.stats.cdnAvailable[prefix] = cdnIcons[prefix].size;
|
|
output.stats.apiTotal[prefix] = allIcons.filter(i => i.prefix === prefix).length;
|
|
output.cdnIcons[prefix] = Array.from(cdnIcons[prefix]).sort();
|
|
});
|
|
|
|
fs.writeFileSync('data/icons-full.json', JSON.stringify(output, null, 2));
|
|
console.log('Generated data/icons-full.json');
|
|
console.log('Total unique icons:', output.stats.totalIcons);
|
|
console.log('Total variants:', output.stats.totalVariants);
|