跳至主要內容

安装/使用

大约 1 分钟快速上手快速上手安装使用

要求

  • 环境: LTS 版本 的 Node.js(18、20)
  • 包管理器: npm >= 8、yarn >= 2 或 pnpm >= 7
  • 使用 Vue3 的 VuePress2 项目

安装

[dir] 文件夹内新建 vuepress-theme-hope 项目:

pnpm
pnpm create vuepress-theme-hope [dir]

要将 vuepress-theme-hope 作为文档构建器添加到现有项目中,请在项目根目录中运行以下命令:

pnpm
pnpm create vuepress-theme-hope add [dir]

重要

这里的 [dir] 是一个参数,你需要使用真实的文件夹名称替换它,例如 docsblog 或其他你喜欢的名称。

使用与配置

请在配置文件中导入并使用 hopeTheme 以使用 vuepress-theme-hopehopeTheme 接受的第一个参数会作为主题配置:

TS
import { defineUserConfig } from "vuepress";
import { hopeTheme } from "vuepress-theme-hope";

export default defineUserConfig({
  theme: hopeTheme({
    // 此处放置主题配置
  }),
});





 


你可以查看 本文档配置open in new window 作为一个配置参考。