1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

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>
This commit is contained in:
Mike L 2020-08-29 01:41:28 +02:00 committed by GitHub
parent 7ba6fea0b7
commit e1eee2d00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View File

@ -18,7 +18,7 @@
url('../fonts/noto-color-emoji/NotoColorEmoji.ttf') format('truetype'); url('../fonts/noto-color-emoji/NotoColorEmoji.ttf') format('truetype');
} }
@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; @default-fonts: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla";
@monospaced-fonts: 'SF Mono', Consolas, Menlo, 'Liberation Mono', Monaco, 'Lucida Console'; @monospaced-fonts: 'SF Mono', Consolas, Menlo, 'Liberation Mono', Monaco, 'Lucida Console';
.override-fonts(@fonts) { .override-fonts(@fonts) {
@ -79,7 +79,7 @@
} }
} }
.override-fonts(@default-fonts); .override-fonts(@default-fonts, sans-serif;);
body { body {
background-color: #ffffff; background-color: #ffffff;
@ -90,27 +90,27 @@ body {
@ja-fonts: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Source Han Sans JP', 'Noto Sans CJK JP', 'Droid Sans Japanese', 'Meiryo', 'MS PGothic'; @ja-fonts: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Source Han Sans JP', 'Noto Sans CJK JP', 'Droid Sans Japanese', 'Meiryo', 'MS PGothic';
:lang(ja) { :lang(ja) {
.override-fonts(@default-fonts, @ja-fonts;); .override-fonts(@default-fonts, @ja-fonts, sans-serif;);
} }
@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; @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;
:lang(zh-CN) { :lang(zh-CN) {
.override-fonts(@default-fonts, @zh-CN-fonts;); .override-fonts(@default-fonts, @zh-CN-fonts, sans-serif;);
} }
@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; @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;
:lang(zh-TW) { :lang(zh-TW) {
.override-fonts(@default-fonts, @zh-TW-fonts;); .override-fonts(@default-fonts, @zh-TW-fonts, sans-serif;);
} }
@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; @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;
:lang(zh-HK) { :lang(zh-HK) {
.override-fonts(@default-fonts, @zh-HK-fonts;); .override-fonts(@default-fonts, @zh-HK-fonts, sans-serif;);
} }
@ko-fonts: 'Apple SD Gothic Neo', 'NanumBarunGothic', 'Malgun Gothic', 'Gulim', 'Dotum', 'Nanum Gothic', 'Source Han Sans KR', 'Noto Sans CJK KR'; @ko-fonts: 'Apple SD Gothic Neo', 'NanumBarunGothic', 'Malgun Gothic', 'Gulim', 'Dotum', 'Nanum Gothic', 'Source Han Sans KR', 'Noto Sans CJK KR';
:lang(ko) { :lang(ko) {
.override-fonts(@default-fonts, @ko-fonts;); .override-fonts(@default-fonts, @ko-fonts, sans-serif;);
} }
img { img {
@ -1072,7 +1072,7 @@ i.icon.centerlock {
.blame-data { .blame-data {
display: flex; display: flex;
font-family: @default-fonts; font-family: @default-fonts, sans-serif;
.blame-message { .blame-message {
flex-grow: 2; flex-grow: 2;

View File

@ -13,6 +13,12 @@ const {resolve, parse} = require('path');
const {LicenseWebpackPlugin} = require('license-webpack-plugin'); const {LicenseWebpackPlugin} = require('license-webpack-plugin');
const {SourceMapDevToolPlugin} = require('webpack'); const {SourceMapDevToolPlugin} = require('webpack');
const postCssPresetEnvConfig = {
features: {
'system-ui-font-family': false,
}
};
const glob = (pattern) => fastGlob.sync(pattern, {cwd: __dirname, absolute: true}); const glob = (pattern) => fastGlob.sync(pattern, {cwd: __dirname, absolute: true});
const themes = {}; const themes = {};
@ -178,7 +184,7 @@ module.exports = {
loader: 'postcss-loader', loader: 'postcss-loader',
options: { options: {
plugins: () => [ plugins: () => [
PostCSSPresetEnv(), PostCSSPresetEnv(postCssPresetEnvConfig),
], ],
sourceMap: true, sourceMap: true,
}, },
@ -204,7 +210,7 @@ module.exports = {
loader: 'postcss-loader', loader: 'postcss-loader',
options: { options: {
plugins: () => [ plugins: () => [
PostCSSPresetEnv(), PostCSSPresetEnv(postCssPresetEnvConfig),
], ],
sourceMap: true, sourceMap: true,
}, },