2024-03-09 01:09:31 +08:00

51 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 配置说明
author: pengzhanbo
createTime: 2024/03/02 10:48:14
permalink: /config/intro/
---
## 概述
VuePress 站点的基本配置文件是 `.vuepress/config.js` ,但也同样支持 TypeScript 配置文件。
你可以使用 `.vuepress/config.ts` 来得到更好的类型提示。
具体而言VuePress 对于配置文件的路径有着约定(按照优先顺序):
当前工作目录 `cwd` 下:
- `vuepress.config.ts`
- `vuepress.config.js`
- `vuepress.config.mjs`
源文件目录 `sourceDir` 下:
- `.vuepress/config.ts`
- `.vuepress/config.js`
- `.vuepress/config.mjs`
基础配置文件示例:
```ts
import { viteBundler } from '@vuepress/bundler-vite'
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
export default defineUserConfig({
bundler: viteBundler(),
theme: plumeTheme(),
lang: 'zh-CN',
title: '你好, VuePress ',
description: '这是我的第一个 VuePress 站点',
})
```
## 类型
在 VuePress 中,有三种配置类型:
- 站点配置: 这是你在 配置文件 中直接导出的对象
- 主题配置: 传递给 `plumeTheme` 的对象参数
- 页面配置: 由在页面顶部基于 YAML 语法的 Frontmatter 提供