2021-05-03 12:57:54 +08:00
|
|
|
import { defineUserConfig } from "@vuepress/cli";
|
|
|
|
import type { DefaultThemeOptions } from "@vuepress/theme-default";
|
2021-04-07 23:09:52 +08:00
|
|
|
import * as sidebar from "./config/sidebar";
|
|
|
|
import * as navbar from "./config/navbar";
|
2021-04-06 23:47:32 +08:00
|
|
|
import * as path from "path";
|
|
|
|
|
2021-05-03 12:57:54 +08:00
|
|
|
const isProduction = process.env.NODE_ENV === "production";
|
|
|
|
|
2021-04-06 23:47:32 +08:00
|
|
|
export default defineUserConfig<DefaultThemeOptions>({
|
|
|
|
theme: path.join(__dirname, "./theme"),
|
2021-05-03 12:57:54 +08:00
|
|
|
plugins: [
|
|
|
|
["vuepress-plugin-mermaidjs"],
|
|
|
|
[
|
|
|
|
"@vuepress/plugin-search",
|
|
|
|
{
|
|
|
|
locales: {
|
|
|
|
"/": {
|
|
|
|
placeholder: "搜索",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
["@vuepress/plugin-debug", !isProduction],
|
|
|
|
],
|
2021-05-15 19:12:43 +08:00
|
|
|
base: "/Xray-docs-next/",
|
2021-04-06 23:47:32 +08:00
|
|
|
locales: {
|
|
|
|
"/": {
|
|
|
|
lang: "zh-CN",
|
|
|
|
title: "Project X",
|
|
|
|
description: "Xray 官方文档",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
themeConfig: {
|
|
|
|
smoothScroll: true,
|
|
|
|
repo: "xtls/xray-core",
|
|
|
|
docsRepo: "xtls/Xray-docs-next",
|
|
|
|
docsDir: "docs",
|
|
|
|
docsBranch: "main",
|
|
|
|
editLinks: true,
|
|
|
|
enableToggle: true,
|
2021-04-07 23:09:52 +08:00
|
|
|
|
2021-04-06 23:47:32 +08:00
|
|
|
themePlugins: {
|
2021-05-03 12:57:54 +08:00
|
|
|
git: isProduction,
|
2021-04-06 23:47:32 +08:00
|
|
|
},
|
2021-04-07 22:20:50 +08:00
|
|
|
locales: {
|
|
|
|
"/": {
|
|
|
|
ToggleText: "切换主题",
|
2021-04-07 23:09:52 +08:00
|
|
|
repoLabel: "查看源码",
|
|
|
|
editLinkText: "帮助我们改善此页面!",
|
2021-05-06 19:27:01 +08:00
|
|
|
tip: "提示",
|
|
|
|
warning: "注意",
|
|
|
|
danger: "警告",
|
2021-04-07 23:09:52 +08:00
|
|
|
sidebar: {
|
|
|
|
"/config/": sidebar.getConfigSidebar(
|
|
|
|
"特性详解",
|
|
|
|
"基础配置",
|
|
|
|
"入站代理",
|
|
|
|
"出站代理",
|
|
|
|
"底层传输",
|
|
|
|
"/config/"
|
|
|
|
),
|
|
|
|
"/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
|
|
|
"小小白白话文",
|
|
|
|
"/document/level-0/"
|
|
|
|
),
|
|
|
|
"/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
|
|
|
"入门技巧",
|
|
|
|
"/document/level-1/"
|
|
|
|
),
|
|
|
|
"/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
|
|
|
"进阶技巧",
|
|
|
|
"/document/level-2/"
|
|
|
|
),
|
2021-04-11 12:36:45 +08:00
|
|
|
"/development/": sidebar.getDevelopmentSidebar(
|
|
|
|
"开发指南",
|
|
|
|
"协议详解",
|
|
|
|
"/development/"
|
|
|
|
),
|
2021-04-07 23:09:52 +08:00
|
|
|
},
|
|
|
|
navbar: navbar.hans,
|
2021-04-07 22:20:50 +08:00
|
|
|
},
|
|
|
|
},
|
2021-04-06 23:47:32 +08:00
|
|
|
},
|
2021-04-11 12:37:45 +08:00
|
|
|
head: [["link", { rel: "icon", href: `/logo.png` }]],
|
2021-04-06 23:47:32 +08:00
|
|
|
markdown: {
|
|
|
|
toc: {
|
|
|
|
level: [2],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
extendsMarkdown: (md) => {
|
|
|
|
md.use(require("markdown-it-footnote"));
|
|
|
|
},
|
2021-05-21 19:10:37 +08:00
|
|
|
bundler: isProduction ? "@vuepress/webpack" : "@vuepress/vite",
|
2021-04-06 23:47:32 +08:00
|
|
|
bundlerConfig: {
|
|
|
|
chainWebpack: (config) => {
|
|
|
|
config.module
|
|
|
|
.rule("webp")
|
|
|
|
.test(/\.(webp)(\?.*)?$/)
|
|
|
|
.use("file-loader")
|
|
|
|
.loader("file-loader")
|
|
|
|
.options({
|
|
|
|
name: `assets/img/[name].[hash:8].[ext]`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//postcss: { plugins: [require("autoprefixer")] }
|
|
|
|
});
|