From 4a4fd70180ea53b0eda7226d578571abf1556240 Mon Sep 17 00:00:00 2001 From: ShittyKopper Date: Wed, 18 Oct 2023 01:41:41 +0300 Subject: [PATCH] upd: partially un-hash CSS class names intended to allow easier creation of custom CSS modifications. the last 4 chars of class names should be static as long as files don't move, but just in case modifications might prefer to use prefix selectors such as [class^=MkWhatever] instead of .MkWhatever-1234 --- packages/frontend/vite.config.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/frontend/vite.config.ts b/packages/frontend/vite.config.ts index da976b791..996e302d9 100644 --- a/packages/frontend/vite.config.ts +++ b/packages/frontend/vite.config.ts @@ -83,11 +83,8 @@ export function getConfig(): UserConfig { modules: { generateScopedName(name, filename, _css): string { const id = (path.relative(__dirname, filename.split('?')[0]) + '-' + name).replace(/[\\\/\.\?&=]/g, '-').replace(/(src-|vue-)/g, ''); - if (process.env.NODE_ENV === 'production') { - return 'x' + toBase62(hash(id)).substring(0, 4); - } else { - return id; - } + const shortId = id.replace(/^(components(-global)?|widgets|ui(-_common_)?)-/, ''); + return shortId + '-' + toBase62(hash(id)).substring(0, 4); }, }, },