83 lines
2.5 KiB
TypeScript
83 lines
2.5 KiB
TypeScript
import tailwindcss from "@tailwindcss/vite";
|
|
import { defineConfig } from "vitepress";
|
|
import { docsDataPlugin } from "./docs-data";
|
|
import { fileURLToPath } from "node:url";
|
|
export default defineConfig({
|
|
lang: "zh-CN",
|
|
title: "HeroUI Vue",
|
|
description: "美观、现代的 Vue UI 组件库",
|
|
appearance: true,
|
|
cleanUrls: true,
|
|
head: [["meta", { name: "theme-color", content: "#f5f5f5" }]],
|
|
markdown: {
|
|
codeCopyButtonTitle: "复制代码",
|
|
headers: { level: [2, 3] },
|
|
config(md) {
|
|
const fence = md.renderer.rules.fence!;
|
|
md.renderer.rules.fence = (...args) =>
|
|
fence(...args)
|
|
.replace(
|
|
/(<button\b[^>]*class="copy"[^>]*>)(<\/button>)/g,
|
|
'$1<DocsCopyIcon class="copy-icon" aria-hidden="true" :size="16" /><DocsCheckIcon class="copied-icon" aria-hidden="true" :size="16" />$2',
|
|
)
|
|
.replace(
|
|
/<button([^>]*class="copy"[^>]*)>([\s\S]*?)<\/button>/g,
|
|
'<DocsCopyButton$1 variant="ghost" is-icon-only>$2</DocsCopyButton>',
|
|
);
|
|
},
|
|
},
|
|
vite: {
|
|
plugins: [
|
|
tailwindcss(),
|
|
{
|
|
name: "workspace-source-dev",
|
|
apply: "serve",
|
|
config: () => ({
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: /^@heroui-vue\/components$/,
|
|
replacement: fileURLToPath(
|
|
new URL(
|
|
"../../../packages/vue/src/index.ts",
|
|
import.meta.url,
|
|
),
|
|
),
|
|
},
|
|
{
|
|
find: /^@heroui-vue\/styles\/css$/,
|
|
replacement: fileURLToPath(
|
|
new URL(
|
|
"../../../packages/styles/index.css",
|
|
import.meta.url,
|
|
),
|
|
),
|
|
},
|
|
{
|
|
find: /^@heroui-vue\/styles$/,
|
|
replacement: fileURLToPath(
|
|
new URL(
|
|
"../../../packages/styles/src/index.ts",
|
|
import.meta.url,
|
|
),
|
|
),
|
|
},
|
|
],
|
|
dedupe: ["vue"],
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ["@heroui-vue/components", "@heroui-vue/styles"],
|
|
},
|
|
}),
|
|
},
|
|
docsDataPlugin(fileURLToPath(new URL("..", import.meta.url))),
|
|
],
|
|
server: {
|
|
host: "127.0.0.1",
|
|
port: Number(process.env.HEROUI_DOCS_PORT ?? 5173),
|
|
strictPort: true,
|
|
watch: { ignored: ["**/.vitepress/dist/**"] },
|
|
},
|
|
},
|
|
});
|