主题配置

Mr.Hope ... 2020-10-13 Basic
  • Vuepress
小于 1 分钟

使用一个主题和使用一个插件的方式几乎一致。

# 使用来自依赖的主题

一个主题可以在以 vuepress-theme-xxx 的形式发布到 npm,你可以这样使用它:

module.exports = {
  theme: "vuepress-theme-xx",
};
1
2
3

# 主题的缩写

如果你的主题名以 vuepress-theme- 开头,你可以使用缩写来省略这个前缀:

module.exports = {
  theme: "xxx",
};
1
2
3

和下面等价:

module.exports = {
  theme: "vuepress-theme-xxx",
};
1
2
3

这也适用于 Scoped Packages (opens new window):

module.exports = {
  theme: "@org/vuepress-theme-xxx", // 或者一个官方主题: '@vuepress/theme-xxx'
};
1
2
3

缩写:

module.exports = {
  theme: "@org/xxx", // 或者一个官方主题: '@vuepress/xxx'
};
1
2
3

注意

@vuepress/theme- 开头的主题是官方维护的主题。