安装
- 直接使用官方库 https://github.com/jackyzha0/quartz 作为克隆模板创建新项目。
- 克隆完成后在本地项目根目录使用 yarn install或npm i安装依赖。
- 使用 npx quartz create创建新的quartz网站
NOTE
在windows下刚刚clone下来的项目中没有content目录,在执行
npx quartz create可能会遇到名为 symlink的错误,自己手工创建即可。(还以为环境安装错了,排查了好久)需要管理员权限运行终端。
可用的Quartz命令
使用示例:npx quartz create
- quartz create Initialize Quart
- quartz update Get the latest Quartz updates
- quartz restore Try to restore your content folder from the cache
- quartz sync Sync your Quartz to and from GitHub.
- quartz build Build Quartz into a bundle of static HTML files
当然你也可以在package.json定义简化语句:
  "scripts": {
    "build": "npx quartz build",
    "docs": "npx quartz build --serve -d docs",
    "check": "tsc --noEmit && npx prettier . --check",
    "format": "npx prettier . --write",
    "test": "tsx ./quartz/util/path.test.ts",
    "profile": "0x -D prof ./quartz/bootstrap-cli.mjs build --concurrency=1",
    "new": "npx quartz create",
    "serve": "npx quartz build --serve"
  },注意事项
在windows通过 npx quartz create创建的smylink似乎无法被 git add 添加进更改目录中。
最好是删除后自己使用 mklink /J link target 手动创建。
使用mklink链接Obsidian
虽然 quartz create 命令中似乎可以选择创建非项目目录中的文件夹符号链接,但是我在实际使用过程中发现该命令创建的方式无法通过 git add 将链接的文件提交到修改列表中。
之后通过 mklink的使用 一文所述,使用 /J 的方式创建好像才可以。