Skip to content

Commit fc8ce47

Browse files
author
Dr. Awesome Doge
committed
perf: 大幅優化網站效能
字體優化: - 減少字體權重 (5→2: 400, 700) - 移除 Inter 字體,使用系統字體替代 - 非阻塞異步載入字體 JavaScript 優化: - 添加 defer 屬性延遲載入 app.js - 關閉 Matrix rain 和 Scanlines 動畫效果 圖片優化: - 添加 loading="lazy" 懶載入 - 優化 post-card 和 product-card 圖片 CSS 優化: - 添加 preload 預載入關鍵 CSS - 更新字體堆疊使用系統字體作為備選
1 parent 607fe08 commit fc8ce47

7 files changed

Lines changed: 16 additions & 14 deletions

File tree

_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ google_analytics: G-ENDDT5D0CR
7777
# Theme Settings
7878
theme_settings:
7979
default_theme: dark # dark | light | auto
80-
enable_matrix: true
81-
enable_scanlines: true
80+
enable_matrix: false # 關閉以提升效能
81+
enable_scanlines: false # 關閉以提升效能
8282
enable_typewriter: true
8383

8484
# SEO

_includes/head.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
<link rel="preconnect" href="https://fonts.googleapis.com">
1010
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1111

12-
<!-- Fonts -->
13-
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Noto+Sans+TC:wght@300;400;500;700&display=swap" rel="stylesheet">
14-
15-
<!-- Main CSS -->
12+
<!-- Critical CSS - Preload -->
13+
<link rel="preload" href="{{ '/assets/css/app.css' | relative_url }}" as="style">
1614
<link rel="stylesheet" href="{{ '/assets/css/app.css' | relative_url }}">
1715

16+
<!-- Fonts - Optimized (reduced weights, async loading) -->
17+
<link rel="preload" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Noto+Sans+TC:wght@400;700&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'">
18+
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Noto+Sans+TC:wght@400;700&display=swap"></noscript>
19+
1820
<!-- Favicon -->
1921
<link rel="shortcut icon" type="image/png" href="{{ '/favicon.png' | relative_url }}">
2022
<link rel="apple-touch-icon" href="{{ '/favicon.png' | relative_url }}">

_includes/post-card.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="card">
22
{% if post.image %}
33
<div class="card-image">
4-
<img src="{{ post.image }}" alt="{{ post.title }}">
4+
<img src="{{ post.image }}" alt="{{ post.title }}" loading="lazy">
55
</div>
66
{% else %}
77
<header class="card-header">

_includes/product-card.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- Image -->
99
<div class="relative aspect-[4/3] bg-cp-dark-200 overflow-hidden">
1010
{% if include.product.image %}
11-
<img src="{{ include.product.image }}" alt="{{ include.product.title }}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300">
11+
<img src="{{ include.product.image }}" alt="{{ include.product.title }}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" loading="lazy">
1212
{% else %}
1313
<div class="w-full h-full flex items-center justify-center bg-gradient-to-br from-cp-dark-200 to-cp-dark-300">
1414
<span class="text-4xl text-cp-dark-400">📖</span>

_layouts/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<!-- Search Modal -->
6767
{% include search-modal.html %}
6868

69-
<!-- Scripts -->
70-
<script src="{{ '/assets/js/app.js' | relative_url }}"></script>
69+
<!-- Scripts - Deferred for Performance -->
70+
<script src="{{ '/assets/js/app.js' | relative_url }}" defer></script>
7171
{% include footer-scripts.html %}
7272
</body>
7373
</html>

assets/css/app.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tailwind.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ module.exports = {
5050
purple: '#bf00ff',
5151
},
5252
},
53-
// 字體
53+
// 字體 - 優化:使用系統字體作為備選
5454
fontFamily: {
55-
'mono': ['JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', 'monospace'],
56-
'sans': ['Inter', 'Noto Sans TC', 'system-ui', 'sans-serif'],
55+
'mono': ['JetBrains Mono', 'ui-monospace', 'SFMono-Regular', 'Monaco', 'Consolas', 'monospace'],
56+
'sans': ['Noto Sans TC', 'system-ui', '-apple-system', 'BlinkMacSystemFont', 'sans-serif'],
5757
},
5858
// 動畫
5959
animation: {

0 commit comments

Comments
 (0)