Skip to content

Commit

Permalink
fix: Fix the icon name as React errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 9, 2022
1 parent f38465e commit 12ce504
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ async function outputReactFile(files: string[], options: SvgToFontOptions = {})
const fontName = options.classNamePrefix || options.fontName
return Promise.all(
files.map(async filepath => {
const name = toPascalCase(path.basename(filepath, '.svg'));
let name = toPascalCase(path.basename(filepath, '.svg'));
if (/^[rR]eact$/.test(name)) {
name = name + toPascalCase(fontName);
}
const svg = fs.readFileSync(filepath, 'utf-8');
const pathData = optimize(svg, {
path: filepath,
Expand Down

0 comments on commit 12ce504

Please sign in to comment.