Skip to content

Commit e1eee2d

Browse files
CL-Jeremysilverwindtechknowlogick
authored
Avoid unnecessary system-ui expansion (#12522)
* Avoid unnecessary system-ui expansion (fix #12325) * extract config to static object Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
1 parent 7ba6fea commit e1eee2d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

web_src/less/_base.less

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
url('../fonts/noto-color-emoji/NotoColorEmoji.ttf') format('truetype');
1919
}
2020

21-
@default-fonts: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" sans-serif;
21+
@default-fonts: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla";
2222
@monospaced-fonts: 'SF Mono', Consolas, Menlo, 'Liberation Mono', Monaco, 'Lucida Console';
2323

2424
.override-fonts(@fonts) {
@@ -79,7 +79,7 @@
7979
}
8080
}
8181

82-
.override-fonts(@default-fonts);
82+
.override-fonts(@default-fonts, sans-serif;);
8383

8484
body {
8585
background-color: #ffffff;
@@ -90,27 +90,27 @@ body {
9090

9191
@ja-fonts: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Source Han Sans JP', 'Noto Sans CJK JP', 'Droid Sans Japanese', 'Meiryo', 'MS PGothic';
9292
:lang(ja) {
93-
.override-fonts(@default-fonts, @ja-fonts;);
93+
.override-fonts(@default-fonts, @ja-fonts, sans-serif;);
9494
}
9595

9696
@zh-CN-fonts: 'PingFang SC', 'Hiragino Sans GB', 'Source Han Sans CN', 'Source Han Sans SC', 'Noto Sans CJK SC', 'Microsoft YaHei', 'Heiti SC', SimHei;
9797
:lang(zh-CN) {
98-
.override-fonts(@default-fonts, @zh-CN-fonts;);
98+
.override-fonts(@default-fonts, @zh-CN-fonts, sans-serif;);
9999
}
100100

101101
@zh-TW-fonts: 'PingFang TC', 'Hiragino Sans TC', 'Source Han Sans TW', 'Source Han Sans TC', 'Noto Sans CJK TC', 'Microsoft JhengHei', 'Heiti TC', PMingLiU;
102102
:lang(zh-TW) {
103-
.override-fonts(@default-fonts, @zh-TW-fonts;);
103+
.override-fonts(@default-fonts, @zh-TW-fonts, sans-serif;);
104104
}
105105

106106
@zh-HK-fonts: 'PingFang HK', 'Hiragino Sans TC', 'Source Han Sans HK', 'Source Han Sans TC', 'Noto Sans CJK TC', 'Microsoft JhengHei', 'Heiti TC', PMingLiU_HKSCS, PMingLiU;
107107
:lang(zh-HK) {
108-
.override-fonts(@default-fonts, @zh-HK-fonts;);
108+
.override-fonts(@default-fonts, @zh-HK-fonts, sans-serif;);
109109
}
110110

111111
@ko-fonts: 'Apple SD Gothic Neo', 'NanumBarunGothic', 'Malgun Gothic', 'Gulim', 'Dotum', 'Nanum Gothic', 'Source Han Sans KR', 'Noto Sans CJK KR';
112112
:lang(ko) {
113-
.override-fonts(@default-fonts, @ko-fonts;);
113+
.override-fonts(@default-fonts, @ko-fonts, sans-serif;);
114114
}
115115

116116
img {
@@ -1072,7 +1072,7 @@ i.icon.centerlock {
10721072

10731073
.blame-data {
10741074
display: flex;
1075-
font-family: @default-fonts;
1075+
font-family: @default-fonts, sans-serif;
10761076

10771077
.blame-message {
10781078
flex-grow: 2;

webpack.config.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ const {resolve, parse} = require('path');
1313
const {LicenseWebpackPlugin} = require('license-webpack-plugin');
1414
const {SourceMapDevToolPlugin} = require('webpack');
1515

16+
const postCssPresetEnvConfig = {
17+
features: {
18+
'system-ui-font-family': false,
19+
}
20+
};
21+
1622
const glob = (pattern) => fastGlob.sync(pattern, {cwd: __dirname, absolute: true});
1723

1824
const themes = {};
@@ -178,7 +184,7 @@ module.exports = {
178184
loader: 'postcss-loader',
179185
options: {
180186
plugins: () => [
181-
PostCSSPresetEnv(),
187+
PostCSSPresetEnv(postCssPresetEnvConfig),
182188
],
183189
sourceMap: true,
184190
},
@@ -204,7 +210,7 @@ module.exports = {
204210
loader: 'postcss-loader',
205211
options: {
206212
plugins: () => [
207-
PostCSSPresetEnv(),
213+
PostCSSPresetEnv(postCssPresetEnvConfig),
208214
],
209215
sourceMap: true,
210216
},

0 commit comments

Comments
 (0)