Pagic

Pagic is a static site generator powered by Deno + React.

Install Deno

# Shell (Mac, Linux):
curl -fsSL https://deno.land/x/install/install.sh | sh

查看安装版本:deno --version,若报错 deno 命令不存在,则需配置环境变量:

Manually add the directory to your $HOME/.bash_profile (or similar) export DENO_INSTALL=”/Users/yixin/.deno” export PATH=”$DENO_INSTALL/bin:$PATH”

  1. 查找当前系统的环境变量:echo $PATH
  2. 打开系统配置文件:sudo vi ~/.bash_profile
  3. 编辑i
  4. 保存:首先按下esc键盘按钮,表示退出编辑,输入:wq!
  5. 退出:首先按下esc键盘按钮,表示退出编辑,输入:q!
  6. 让编辑过的文件生效:source ~/.bash_profile

Install Pagic

// install the latest version of Pagic
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic/mod.ts

Initialize the project

mkdir site && cd site && echo "export default {};" > pagic.config.ts && echo "# Hello world" > README.md

Run pagic build

# Build a static website
pagic build --watch --serve
# --watch   Watch file changes to rebuild
# --serve   Start local service, preview static website
# --port    Specify the port of the local service

open http://127.0.0.1:8000/ with a browser

参考网站