Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better css class names #46

Merged
merged 7 commits into from
Jan 22, 2024
Merged

better css class names #46

merged 7 commits into from
Jan 22, 2024

Conversation

jantimon
Copy link
Owner

@jantimon jantimon commented Jan 19, 2024

shot-sIr9gJpE
shot-udXCnq3g

@jantimon jantimon requested a review from Mad-Kat January 19, 2024 10:56
Copy link

vercel bot commented Jan 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yacijs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2024 9:11am

Copy link

codspeed-hq bot commented Jan 19, 2024

CodSpeed Performance Report

Merging #46 will not alter performance

Comparing feature/better-css-class-names (37eb9e4) with main (658b730)

Summary

✅ 2 untouched benchmarks

* @param {number} i
*/
function unreadableNumber(i) {
return i.toString(25).replace(/\d/g, (m) => (Number(m)+26).toString(36));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need such a "complicated" logic for this problem. At the moment it generates strings beginning from "q" instead of "0" and iterates through the alphabet. Can we just start with "a" if numbers are to distracting? Or keep it simple and a number for the moment 😄

Copy link
Owner Author

@jantimon jantimon Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's like a hex algorithm but without numbers - but yes probably to complicated 😄

0 'q'
1 'r'
2 's'
3 't'
4 'u'
5 'v'
6 'w'
7 'x'
8 'y'
9 'z'
10 'a'
11 'b'
12 'c'
13 'd'
14 'e'
15 'f'
16 'g'
17 'h'
18 'i'
19 'j'
20 'k'
21 'l'
22 'm'
23 'n'
24 'o'
25 'rq'
26 'rr'
27 'rs'
28 'rt'
29 'ru'
30 'rv'
31 'rw'
32 'rx'
33 'ry'
34 'rz'
35 'ra'
36 'rb'
37 'rc'
38 'rd'
39 're'
40 'rf'
41 'rg'
42 'rh'
43 'ri'
44 'rj'
45 'rk'
46 'rl'
47 'rm'
48 'rn'
49 'ro'

@jantimon
Copy link
Owner Author

jantimon commented Jan 22, 2024

I guess instead of making the number less readable we should try to remove the number whenever the class name exists only once in the file.

So I reverted the unreadableNumber change and we can reduce the number usage in a future pr

I also added tests

@jantimon jantimon requested a review from Mad-Kat January 22, 2024 09:05
@Mad-Kat
Copy link
Collaborator

Mad-Kat commented Jan 22, 2024

Strongly agree with your take and thank you for the additional tests :)

@Mad-Kat Mad-Kat merged commit 5de68d6 into main Jan 22, 2024
6 checks passed
@jantimon jantimon deleted the feature/better-css-class-names branch February 7, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants