process-svgs.js 452 Bytes
Newer Older
1 2 3 4 5
import fs from 'fs';
import path from 'path';

import processSvg from './process-svg';

Cole Bemis's avatar
Cole Bemis committed
6 7
const IN_DIR = path.resolve(__dirname, '../icons');

Cole Bemis's avatar
Cole Bemis committed
8
console.log(`Processing SVGs in ${IN_DIR}...`);
9 10

fs
Cole Bemis's avatar
Cole Bemis committed
11
  .readdirSync(IN_DIR)
12 13
  .filter(file => path.extname(file) === '.svg')
  .forEach(svgFile => {
Cole Bemis's avatar
Cole Bemis committed
14 15 16 17
    const svg = fs.readFileSync(path.join(IN_DIR, svgFile));
    processSvg(svg).then(svg =>
      fs.writeFileSync(path.join(IN_DIR, svgFile), svg),
    );
18
  });