Skip to content

Commit

Permalink
fix: path resolving for generate-icon-fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Nov 29, 2024
1 parent 029401e commit cc4b416
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/generate-icon-fonts/svg-to-font.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fileURLToPath } from 'node:url';
import { fileURLToPath } from "node:url";
import path from "node:path";

import svgtofont from "svgtofont";
Expand All @@ -18,7 +18,14 @@ const svgToFont = async (
lastSlashIndex = fileName.lastIndexOf("/");
}

const generateIconFontsDir = fileName.slice(0, Math.max(0, lastSlashIndex));
let generateIconFontsDir = fileName.slice(0, Math.max(0, lastSlashIndex));

if (generateIconFontsDir.endsWith("generate-icon-fonts")) {
generateIconFontsDir = generateIconFontsDir.replace(
"generate-icon-fonts",
"",
);
}

try {
return svgtofont({
Expand Down

0 comments on commit cc4b416

Please sign in to comment.