From 79bd90dcda83f454961e33fe2467bdcd01c60df9 Mon Sep 17 00:00:00 2001 From: erwan Date: Wed, 6 Nov 2024 17:38:03 +0100 Subject: [PATCH] update mangled script --- examples/react-template/index.tsx | 2 +- .../styles/config/plugins/vite-plugin-mangler.tsx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/react-template/index.tsx b/examples/react-template/index.tsx index 52d529c1..584d719f 100644 --- a/examples/react-template/index.tsx +++ b/examples/react-template/index.tsx @@ -9,7 +9,7 @@ const root = ReactDOM.createRoot(rootElement) root.render( - + diff --git a/packages/styles/config/plugins/vite-plugin-mangler.tsx b/packages/styles/config/plugins/vite-plugin-mangler.tsx index f33bef79..2483b84a 100644 --- a/packages/styles/config/plugins/vite-plugin-mangler.tsx +++ b/packages/styles/config/plugins/vite-plugin-mangler.tsx @@ -5,13 +5,13 @@ export const cssPlugin = () => { name: 'css-transform', transform(src: string, id: string) { if (/mangled\.(scss)$/.test(id)) { - src.replace(/(\.[a-z][_\-0-9a-z]*)(?=[^\{]*{)/gi, (match) => { - return `${match}__${HASH}` - }) - - return src.replace(/url\(\s*['"]?[^"')]*$/i, (match) => { - return match.split('_')[0] - }) + return src + .replace(/(\.[a-z][_\-0-9a-z]*)(?=[^\{]*{)/gi, (match) => { + return `${match}__${HASH}` + }) + .replace(/url\(\s*['"]?[^"')]*$/i, (match) => { + return match.split('_')[0] + }) } }, }