feat(fonts): 字体三轨预分片自托管接入

- lxgw-wenkai-screen-webfont + @fontsource/noto-sans-sc(400/500/700)
  + @fontsource/jetbrains-mono(400/700),均 OFL
- unicode-range 按需加载 + font-display swap;家族名与 tokens 栈首一致
- 教训:包 css 不能经 .css 文件 ESM import,须组件 frontmatter 持有

验证: pnpm astro build exit 0;dist woff2 分片 399 个(>50 门槛)

Spec: 2026-10-24_add-blog-skeleton
Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-10-24 23:08:36 +08:00
1 parent 4cb1c85cc3
commit ee53279822
3 files changed
+35 -1

No files matched your search

+4 -1
View File
@@ -10,6 +10,9 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"astro": "^7.3.8" "@fontsource/jetbrains-mono": "^5.3.0",
"@fontsource/noto-sans-sc": "^5.3.1",
"astro": "^7.3.8",
"lxgw-wenkai-screen-webfont": "^1.7.0"
} }
} }
+24
View File
@@ -8,9 +8,18 @@ importers:
.: .:
dependencies: dependencies:
'@fontsource/jetbrains-mono':
specifier: ^5.3.0
version: 5.3.0
'@fontsource/noto-sans-sc':
specifier: ^5.3.1
version: 5.3.1
astro: astro:
specifier: ^7.3.8 specifier: ^7.3.8
version: 7.3.8(yaml@2.9.1) version: 7.3.8(yaml@2.9.1)
lxgw-wenkai-screen-webfont:
specifier: ^1.7.0
version: 1.7.0
packages: packages:
@@ -195,6 +204,12 @@ packages:
'@emnapi/wasi-threads@1.2.3': '@emnapi/wasi-threads@1.2.3':
resolution: {integrity: sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==} resolution: {integrity: sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==}
'@fontsource/jetbrains-mono@5.3.0':
resolution: {integrity: sha512-fqDfB5I9f1p1TV486aUgB9t8zP84P0O1FtQR5Ol9vjwPy+S+EIGlVYm1cvj2W5shcZMTg2nZFdVMoH5wFu8a1A==}
'@fontsource/noto-sans-sc@5.3.1':
resolution: {integrity: sha512-YxZ/VWAWo9FWzH08Q6fGTzIW6vYNP2TMhUFCnfhlimbhdXnWrxJLrzX3KWt2FKnV0s8XiM5vjpGHQiyFRlTj0w==}
'@img/colour@1.1.0': '@img/colour@1.1.0':
resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
engines: {node: '>=18'} engines: {node: '>=18'}
@@ -830,6 +845,9 @@ packages:
resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==} resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==}
engines: {node: 20 || >=22} engines: {node: 20 || >=22}
lxgw-wenkai-screen-webfont@1.7.0:
resolution: {integrity: sha512-xvfF4V26Mb335xKg3uxljz+V2nq4F5ek0ku9pmyKgT0Dzo/d2rHi7WpnqgvM9mlXAcAKOrxrcDmUZiIs/ZQ9bQ==}
magic-string@1.4.3: magic-string@1.4.3:
resolution: {integrity: sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==} resolution: {integrity: sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==}
@@ -1400,6 +1418,10 @@ snapshots:
tslib: 2.8.1 tslib: 2.8.1
optional: true optional: true
'@fontsource/jetbrains-mono@5.3.0': {}
'@fontsource/noto-sans-sc@5.3.1': {}
'@img/colour@1.1.0': '@img/colour@1.1.0':
optional: true optional: true
@@ -1973,6 +1995,8 @@ snapshots:
lru-cache@11.5.3: {} lru-cache@11.5.3: {}
lxgw-wenkai-screen-webfont@1.7.0: {}
magic-string@1.4.3: magic-string@1.4.3:
dependencies: dependencies:
'@jridgewell/sourcemap-codec': 1.6.0 '@jridgewell/sourcemap-codec': 1.6.0
+7
View File
@@ -1,5 +1,12 @@
--- ---
// T1 占位首页:T5 起替换为 BaseLayout + 真实首页结构 // T1 占位首页:T5 起替换为 BaseLayout + 真实首页结构
// 字体三轨在此预挂(T5 移入 BaseLayout):unicode-range 预分片自托管
import 'lxgw-wenkai-screen-webfont/lxgwwenkaiscreen.css';
import '@fontsource/noto-sans-sc/400.css';
import '@fontsource/noto-sans-sc/500.css';
import '@fontsource/noto-sans-sc/700.css';
import '@fontsource/jetbrains-mono/400.css';
import '@fontsource/jetbrains-mono/700.css';
import '../styles/global.css'; import '../styles/global.css';
--- ---
<html lang="zh"> <html lang="zh">