Skip to content

Commit 5e0e2d5

Browse files
committed
refactor(sidebar): 统一管理侧边栏图标常量
1 parent d56fafc commit 5e0e2d5

File tree

15 files changed

+332
-471
lines changed

15 files changed

+332
-471
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ format-markdown.py
1616
.npmrc
1717
package-lock.json
1818
lintmd-config.json
19+
.claude/settings.local.json

docs/.vuepress/client.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/.vuepress/components/LayoutToggle.vue

Lines changed: 0 additions & 119 deletions
This file was deleted.

docs/.vuepress/config.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ export default defineUserConfig({
1414
// meta
1515
["meta", { name: "robots", content: "all" }],
1616
["meta", { name: "author", content: "Guide" }],
17-
[
18-
"meta",
19-
{
20-
"http-equiv": "Cache-Control",
21-
content: "no-cache, no-store, must-revalidate",
22-
},
23-
],
24-
["meta", { "http-equiv": "Pragma", content: "no-cache" }],
25-
["meta", { "http-equiv": "Expires", content: "0" }],
2617
[
2718
"meta",
2819
{
@@ -40,21 +31,38 @@ export default defineUserConfig({
4031
},
4132
],
4233
["meta", { name: "apple-mobile-web-app-capable", content: "yes" }],
43-
// 添加百度统计
34+
// 添加百度统计 - 异步加载避免阻塞渲染
4435
[
4536
"script",
46-
{},
37+
{ defer: true },
4738
`var _hmt = _hmt || [];
4839
(function() {
4940
var hm = document.createElement("script");
5041
hm.src = "https://hm.baidu.com/hm.js?5dd2e8c97962d57b7b8fea1737c01743";
42+
hm.async = true;
5143
var s = document.getElementsByTagName("script")[0];
5244
s.parentNode.insertBefore(hm, s);
5345
})();`,
5446
],
5547
],
5648

57-
bundler: viteBundler(),
49+
bundler: viteBundler({
50+
viteOptions: {
51+
build: {
52+
chunkSizeWarningLimit: 1000,
53+
rollupOptions: {
54+
output: {
55+
manualChunks: {
56+
// 将大型第三方库分离成单独的 chunk
57+
vue: ["vue", "vue-router"],
58+
// VuePress 相关
59+
vuepress: ["vuepress"],
60+
},
61+
},
62+
},
63+
},
64+
},
65+
}),
5866

5967
theme,
6068

docs/.vuepress/navbar.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { navbar } from "vuepress-theme-hope";
33
export default navbar([
44
{ text: "面试指南", icon: "java", link: "/home.md" },
55
{ text: "开源项目", icon: "github", link: "/open-source-project/" },
6-
{ text: "技术书籍", icon: "book", link: "/books/" },
7-
{
8-
text: "程序人生",
9-
icon: "article",
10-
link: "/high-quality-technical-articles/",
11-
},
6+
{ text: "实战项目", icon: "project", link: "/zhuanlan/interview-guide.md" },
127
{
138
text: "知识星球",
149
icon: "planet",
@@ -18,18 +13,26 @@ export default navbar([
1813
icon: "about",
1914
link: "/about-the-author/zhishixingqiu-two-years.md",
2015
},
21-
{
22-
text: "星球专属优质专栏",
23-
icon: "about",
24-
link: "/zhuanlan/",
25-
},
16+
{ text: "星球专属优质专栏", icon: "about", link: "/zhuanlan/" },
2617
{
2718
text: "星球优质主题汇总",
2819
icon: "star",
2920
link: "https://www.yuque.com/snailclimb/rpkqw1/ncxpnfmlng08wlf1",
3021
},
3122
],
3223
},
24+
{
25+
text: "推荐阅读",
26+
icon: "book",
27+
children: [
28+
{ text: "技术书籍", icon: "book", link: "/books/" },
29+
{
30+
text: "程序人生",
31+
icon: "code",
32+
link: "/high-quality-technical-articles/",
33+
},
34+
],
35+
},
3336
{
3437
text: "网站相关",
3538
icon: "about",

docs/.vuepress/sidebar/about-the-author.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { arraySidebar } from "vuepress-theme-hope";
2+
import { ICONS } from "./constants.js";
23

34
export const aboutTheAuthor = arraySidebar([
45
{
56
text: "个人经历",
6-
icon: "experience",
7+
icon: ICONS.EXPERIENCE,
78
collapsible: false,
89
children: [
910
"internet-addiction-teenager",
@@ -15,7 +16,7 @@ export const aboutTheAuthor = arraySidebar([
1516
},
1617
{
1718
text: "杂谈",
18-
icon: "chat",
19+
icon: ICONS.CHAT,
1920
collapsible: false,
2021
children: [
2122
"writing-technology-blog-six-years",

docs/.vuepress/sidebar/books.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
import { arraySidebar } from "vuepress-theme-hope";
2+
import { ICONS } from "./constants.js";
23

34
export const books = arraySidebar([
45
{
56
text: "计算机基础",
67
link: "cs-basics",
7-
icon: "computer",
8+
icon: ICONS.COMPUTER,
89
},
910
{
1011
text: "数据库",
1112
link: "database",
12-
icon: "database",
13+
icon: ICONS.DATABASE,
1314
},
1415
{
1516
text: "搜索引擎",
1617
link: "search-engine",
17-
icon: "search",
18+
icon: ICONS.SEARCH,
1819
},
1920
{
2021
text: "Java",
2122
link: "java",
22-
icon: "java",
23+
icon: ICONS.JAVA,
2324
},
2425
{
2526
text: "软件质量",
2627
link: "software-quality",
27-
icon: "highavailable",
28+
icon: ICONS.HIGH_AVAILABLE,
2829
},
2930

3031
{
3132
text: "分布式",
3233
link: "distributed-system",
33-
icon: "distributed-network",
34+
icon: ICONS.DISTRIBUTED,
3435
},
3536
]);

0 commit comments

Comments
 (0)