Skip to content

Instantly share code, notes, and snippets.

@tcdw
Last active July 6, 2020 11:40
Show Gist options
  • Select an option

  • Save tcdw/16ebbe5b9be0f378c55e6140b293b9a1 to your computer and use it in GitHub Desktop.

Select an option

Save tcdw/16ebbe5b9be0f378c55e6140b293b9a1 to your computer and use it in GitHub Desktop.

目录结构

  • dist 编译好的 CSS 与 JS 存放的位置
  • src 没有编译的源文件存放位置
  • static 一些不需要编译的资源文件
  • include 模板中嵌入的片段,例如 header 与 footer
  • cdn CDN 配置
  • i18n 主题语言文件
  • index.html 首页(列表页)
  • post.html 文章页
  • package.json 标准的 NPM 包信息文件
  • package-lock.json 同上
  • metadata.json SilverBlog 主题元数据

metadata 内容

{
    "name": "tcdw2018",
    "description": "tcdw 2018 style for SilverBlog!",
    "author": "tcdw <[email protected]>",
    "bug": "https://github.com/silverblog-theme/tcdw2018/issues",
    "license": "MIT",
    "homepage": "https://github.com/silverblog-theme/tcdw2018",
    "requireCompile": true,
    "download": [
        {
            "url": "https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css",
            "path": "font-awesome.css/css",
            "filename": "font-awesome.min.css"
        }
    ]
}

如果 requireCompile 设为 true,且目标系统存在 Node.js 环境,则额外执行以下步骤:

  1. 自动执行 npm install
  2. 自动执行 npm run build
  3. dist 目录下的所有文件拷贝到 static 目录下

.gitignore 中需要额外填写以下内容:

# 整个 dist 目录
dist

# static 中已知会被拷贝过来的编译结果文件
static/bundle.css
static/bundle.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment