🛠️ Refactor svgr endpoint, disable optimization with `optimize` property
📦 Build / 🛠️ Build app (push) Has been cancelled
🧑‍🚀 Check / ⚙️ Linting (push) Has been cancelled
🧑‍🚀 Check / 📦 SVGs Size (push) Has been cancelled

This commit is contained in:
pheralb
2025-09-24 17:00:57 +01:00
parent 49f860f25f
commit 9cf1677e51
+7 -3
View File
@@ -12,14 +12,18 @@ export const POST = async ({ request }: RequestEvent) => {
try {
const body = await request.json();
const svgCode = body.code;
let svgCode = body.code;
const typescript = body.typescript;
const name = body.name.replace(/[^a-zA-Z0-9]/g, "");
const optimizedSvg = optimizeSvg({ svgCode });
const shouldOptimize = body.optimize !== false;
if (shouldOptimize) {
svgCode = optimizeSvg({ svgCode });
}
const code = await parseReactSvgContent({
componentName: name,
svgCode: optimizedSvg,
svgCode: svgCode,
typescript,
});