2020-10-06 20:23:26 +02:00
|
|
|
import fs from 'fs';
|
|
|
|
|
import path from 'path';
|
2025-06-18 15:47:24 +02:00
|
|
|
import { readSvgDirectory, writeSvgFile } from '../tools/build-helpers/helpers.ts';
|
|
|
|
|
import processSvg from './render/processSvg.mts';
|
2020-10-06 20:23:26 +02:00
|
|
|
|
2022-04-06 11:10:10 +02:00
|
|
|
const ICONS_DIR = path.resolve(process.cwd(), 'icons');
|
2020-10-06 20:23:26 +02:00
|
|
|
|
|
|
|
|
console.log(`Optimizing SVGs...`);
|
|
|
|
|
|
2025-06-18 15:47:24 +02:00
|
|
|
const svgFiles = await readSvgDirectory(ICONS_DIR);
|
2020-10-06 20:23:26 +02:00
|
|
|
|
2025-06-18 15:47:24 +02:00
|
|
|
svgFiles.forEach((svgFile: string) => {
|
|
|
|
|
const content = fs.readFileSync(path.join(ICONS_DIR, svgFile), 'utf-8');
|
2023-02-28 17:24:17 +01:00
|
|
|
processSvg(content, svgFile).then((svg) => writeSvgFile(svgFile, ICONS_DIR, svg));
|
2020-10-06 20:23:26 +02:00
|
|
|
});
|