From 700e894805687bcb54cf681ceb81d1b66fdcae6b Mon Sep 17 00:00:00 2001 From: Fechin Date: Wed, 25 Jun 2025 14:43:51 +0800 Subject: [PATCH] fix: prevent SVG path corruption during build Wrap SVG icons with htmlclean-protect comments to prevent minification from corrupting path data, ensuring icons display correctly after build. --- themes/coo/scripts/global.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/coo/scripts/global.js b/themes/coo/scripts/global.js index 008846e..60c1cb4 100644 --- a/themes/coo/scripts/global.js +++ b/themes/coo/scripts/global.js @@ -92,12 +92,13 @@ function svgIcon(name) { // Check file exists const svgPath = path.resolve('./', 'source/assets/icon/', `${name}.svg`); if (fs.existsSync(svgPath)) { - return fs.readFileSync(svgPath, 'utf8'); + const svgContent = fs.readFileSync(svgPath, 'utf8'); + return `${svgContent}`; } else { - return ( + const defaultSvg = '\n' + ' \n' + - '' - ); + ''; + return `${defaultSvg}`; } }