merge: partially un-hash CSS class names (#109)

This commit is contained in:
Marie 2023-10-22 19:51:38 +02:00 committed by GitHub
commit 38412eef18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,11 +83,8 @@ export function getConfig(): UserConfig {
modules: { modules: {
generateScopedName(name, filename, _css): string { generateScopedName(name, filename, _css): string {
const id = (path.relative(__dirname, filename.split('?')[0]) + '-' + name).replace(/[\\\/\.\?&=]/g, '-').replace(/(src-|vue-)/g, ''); const id = (path.relative(__dirname, filename.split('?')[0]) + '-' + name).replace(/[\\\/\.\?&=]/g, '-').replace(/(src-|vue-)/g, '');
if (process.env.NODE_ENV === 'production') { const shortId = id.replace(/^(components(-global)?|widgets|ui(-_common_)?)-/, '');
return 'x' + toBase62(hash(id)).substring(0, 4); return shortId + '-' + toBase62(hash(id)).substring(0, 4);
} else {
return id;
}
}, },
}, },
}, },