Skip to content

Commit 287423c

Browse files
committed
Refactor language-specific font definitions to consolidate into :root selectors for improved maintainability and readability
1 parent abbbbe1 commit 287423c

3 files changed

Lines changed: 37 additions & 31 deletions

File tree

stylesheets/compiled.css

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,24 @@
125125
--color-icon-default: #a8a29e;
126126
}
127127

128+
/* Language-specific font subsets */
129+
130+
:root:lang(zh-CN), [lang="zh-CN"] {
131+
--noto-sans-subset: "Noto Sans SC";
132+
}
133+
134+
:root:lang(zh-TW), [lang="zh-TW"] {
135+
--noto-sans-subset: "Noto Sans TC";
136+
}
137+
138+
:root:lang(ko), [lang="ko"] {
139+
--noto-sans-subset: "Noto Sans KR";
140+
}
141+
142+
:root:lang(ja), [lang="ja"] {
143+
--noto-sans-subset: "Noto Sans JP";
144+
}
145+
128146
/* Custom fonts if needed */
129147

130148
/* Import component styles */
@@ -1966,21 +1984,7 @@ body:is(.dark *){
19661984
color: rgb(250 250 249 / var(--tw-text-opacity, 1));
19671985
}
19681986

1969-
html:lang(zh-CN), [lang="zh-CN"] {
1970-
--noto-sans-subset: "Noto Sans SC";
1971-
}
1972-
1973-
html:lang(zh-TW), [lang="zh-TW"] {
1974-
--noto-sans-subset: "Noto Sans TC";
1975-
}
1976-
1977-
html:lang(ko), [lang="ko"] {
1978-
--noto-sans-subset: "Noto Sans KR";
1979-
}
1980-
1981-
html:lang(ja), [lang="ja"] {
1982-
--noto-sans-subset: "Noto Sans JP";
1983-
}
1987+
/* CJK fonts */
19841988

19851989
html:lang(ja),
19861990
body:lang(ja),

stylesheets/tailwind.css

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,7 @@
2424
@apply dark:bg-stone-900 dark:text-stone-50;
2525
}
2626

27-
html:lang(zh-CN), [lang="zh-CN"] {
28-
--noto-sans-subset: "Noto Sans SC";
29-
}
30-
31-
html:lang(zh-TW), [lang="zh-TW"] {
32-
--noto-sans-subset: "Noto Sans TC";
33-
}
34-
35-
html:lang(ko), [lang="ko"] {
36-
--noto-sans-subset: "Noto Sans KR";
37-
}
38-
39-
html:lang(ja), [lang="ja"] {
40-
--noto-sans-subset: "Noto Sans JP";
41-
}
42-
27+
/* CJK fonts */
4328
html:lang(ja),
4429
body:lang(ja),
4530
.font-default:lang(ja),

stylesheets/variables.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,20 @@
117117
/* Icon colors */
118118
--color-icon-default: #a8a29e;
119119
}
120+
121+
/* Language-specific font subsets */
122+
:root:lang(zh-CN), [lang="zh-CN"] {
123+
--noto-sans-subset: "Noto Sans SC";
124+
}
125+
126+
:root:lang(zh-TW), [lang="zh-TW"] {
127+
--noto-sans-subset: "Noto Sans TC";
128+
}
129+
130+
:root:lang(ko), [lang="ko"] {
131+
--noto-sans-subset: "Noto Sans KR";
132+
}
133+
134+
:root:lang(ja), [lang="ja"] {
135+
--noto-sans-subset: "Noto Sans JP";
136+
}

0 commit comments

Comments
 (0)