From cc4b416df4e6d36c11401515fb30ab24480dbc61 Mon Sep 17 00:00:00 2001 From: Nicolas Merget Date: Fri, 29 Nov 2024 11:46:36 +0100 Subject: [PATCH] fix: path resolving for generate-icon-fonts --- src/generate-icon-fonts/svg-to-font.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/generate-icon-fonts/svg-to-font.ts b/src/generate-icon-fonts/svg-to-font.ts index eb813ca7..d88fe793 100644 --- a/src/generate-icon-fonts/svg-to-font.ts +++ b/src/generate-icon-fonts/svg-to-font.ts @@ -1,4 +1,4 @@ -import { fileURLToPath } from 'node:url'; +import { fileURLToPath } from "node:url"; import path from "node:path"; import svgtofont from "svgtofont"; @@ -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({