Skip to content

Commit

Permalink
Fix one more issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcconechy committed Sep 19, 2023
1 parent 6a1e97a commit 32f5a49
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/node/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ function optimizeSVGs(src) {
svgFile = dataOptimized.data.replace(`xmlns="http://www.w3.org/2000/svg"`, `xmlns="http://www.w3.org/2000/svg" style="color: transparent; fill: #28282A;"`);
}

const pathStatement = svgFile
let pathStatement = svgFile
.replace(/<svg[^>]*>/g, '')
.replace(/<\/svg>/g, '');
pathStatement = pathStatement.replaceAll('#000', 'currentColor');
const hasStroke2 = svgFile.indexOf('stroke="currentColor"') > -1;
if (!hasStroke2) pathStatement = pathStatement.replace('d=', 'fill="currentColor" stroke="none" d=');

iconJSON += `"${path.basename(filepath, '.svg')}": "${pathStatement.replace(/"/g, '\\"')}"${mapIndex + 1 === (last) ? '' : ','}\n`;
await fs.writeFileSync(filepath, svgFile, 'utf-8');
} catch (err) {
Expand Down

0 comments on commit 32f5a49

Please sign in to comment.