先决条件

  • Hugo
  • Node.js
  • npm

假设你已经安装了 Hugo,如果没有,请先安装 Hugo.

使用NVM安装 Node.js 和 npm(一定是最新版):

1
2
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.nvm/nvm.sh  && nvm install node

创建新项目

以下命令将启动一个交互式命令行界面 (CLI),引导您完成设置过程.请选择您已安装的软件包管理器:

1
npm create thulite@latest
  1. 输入您的项目名称——这也是安装目录(例如我想把项目安装在根目录的site目录下,应该输入 /site)

    1
    2
    3
    4
    
    ◆  Project name:
    │  /site
    
  2. 选择 Doks 主题模板

    1
    2
    3
    4
    5
    6
    7
    
    ◆  Select a template:
    │  ● Doks theme
    │  ○ Bolt theme
    │  ○ Tailwind CSS starter
    │  ○ Bootstrap starter
    │  ○ Basic starter
    
  3. 选择一个变体

    1
    2
    3
    
    ◆  Select a variant:
    │  ● With recommended integrations (SEO and Images)
    
  4. 自动生成一个项目的基础结构(脚手架)

    1
    2
    3
    
    ◇  Scaffolding project in /site...
    └  Done. Now run:

    现在您将拥有一个新的项目目录,其中包含您的网站所需的所有文件和配置.

  5. 进入项目目录并安装依赖项

    1
    
    cd /site && npm install
  6. 构建站点

    1
    
    npm run build