Files
lucide/scripts/optimizeSvgs.mjs
Louis Bailleau 55ae908018 Update all packages dependencies in project root (#863)
* Update `svgo` and `svgson` version and fix some tests

* Update eslint-related packages and fix all linter errors

* Update all rollup-related packages version

* Update all rollup-related packages (part 2)

* Update the rest of package which need to be updated

* Fix unwanted comment

* Fix unwanted comment (again)
2022-11-07 22:29:19 +01:00

16 lines
479 B
JavaScript

import fs from 'fs';
import path from 'path';
import processSvg from './render/processSvg.mjs';
import { readSvgDirectory, writeSvgFile } from './helpers.mjs';
const ICONS_DIR = path.resolve(process.cwd(), 'icons');
console.log(`Optimizing SVGs...`);
const svgFiles = readSvgDirectory(ICONS_DIR);
svgFiles.forEach((svgFile) => {
const content = fs.readFileSync(path.join(ICONS_DIR, svgFile));
processSvg(content).then((svg) => writeSvgFile(svgFile, ICONS_DIR, svg));
});