Butterfly 安装文档-快速开始

📖 本教程更新于 2023 年 06 月 06 日,教程的内容针对最新稳定版而更新(如果你是旧版,教程会有些出入,请留意)

🦋 Butterfly 已经更新到 4.9.0


hexo-theme-butterfly 是基于 hexo-theme-melody 的基础上进行开发的。

安装

  • Git 安装 (Github)
  • Git 安装 (Gitee)
  • npm 安装

稳定版【建议】

在你的 Hexo 根目录里

1
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

测试版

测试版可能存在 bug,追求稳定的请安装稳定版

如果想要安装比较新的 dev 分支,可以

1
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

升级方法:在主题目录下,运行 git pull

稳定版【建议】

在你的 Hexo 根目录里

1
git clone -b master https://gitee.com/immyw/hexo-theme-butterfly.git themes/butterfly

测试版

测试版可能存在 Bugs,追求稳定的请安装稳定版

如果想要安装比较新的 dev 分支,可以

1
git clone -b dev https://gitee.com/immyw/hexo-theme-butterfly.git themes/butterfly

升级方法:在主题目录下,运行 git pull

此方法只支持 Hexo 5.0.0 以上版本

_通过 npm 安装并不会在 themes 里生成主题文档夹,而是在 node_modules 里生成_

在你的 Hexo 根目录里

1
npm install hexo-theme-butterfly

升级方法:在 Hexo 根目录下,运行 npm update hexo-theme-butterfly

应用主题

修改 Hexo 根目录下的 _config.yml,把主题改为 butterfly

1
theme: butterfly;

安装插件

如果你没有 pug 以及 stylus 的渲染器,请下载安装:

1
npm install hexo-renderer-pug hexo-renderer-stylus --save

升级建议

升级完成后,请到 Github 的 Releases 界面 或者 文档七 查看新版的更新内容。

里面有标注 _config 文档的变更内容(如有),请根据实际情况更新你的配置内容。

为了减少升级主题后带来的不便,请使用以下方法(建议,可以不做)。

在 hexo 的根目录创建一个文档 _config.butterfly.yml,并把主题目录的 _config.yml 内容拷贝到 _config.butterfly.yml 去。( 注意: 拷贝的是主题的 _config.yml ,而不是 hexo 的 _config.yml)

注意: 不要把主题目录的 _config.yml 删掉

注意: 以后只需要在 _config.butterfly.yml 进行配置就行。
如果使用了 _config.butterfly.yml, 配置主题的 _config.yml 将不会有效果。

Hexo 会自动合并主题中的 _config.yml_config.butterfly.yml 里的配置,如果存在同名配置,会使用 _config.butterfly.yml 的配置,其优先度较高。

image-20200805191531090

转载自:https://butterfly.js.org/posts/21cfbf15/