Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
upd: partially un-hash CSS class names
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wont-work committed Oct 22, 2023
1 parent 97d9510 commit 4a4fd70
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
},
},
Expand Down

0 comments on commit 4a4fd70

Please sign in to comment.