From 1f386abbcc0ac34e8e79a784b42d7758b5c15051 Mon Sep 17 00:00:00 2001 From: handsomezhuzhu <2658601135@qq.com> Date: Sun, 24 Aug 2025 10:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 99 + .gitignore | 5 + .npmrc | 1 + README.md | 69 + docs/.vitepress/blog-theme.ts | 105 + docs/.vitepress/config.mts | 58 + docs/.vitepress/theme/assets/bg.webp | Bin 0 -> 16282 bytes docs/.vitepress/theme/index.ts | 9 + docs/.vitepress/theme/style.scss | 13 + docs/.vitepress/theme/user-theme.css | 26 + docs/about.md | 67 + docs/index.md | 16 + docs/public/.spa | 0 docs/public/favicon.ico | Bin 0 -> 28349 bytes docs/public/logo.png | Bin 0 -> 28349 bytes docs/public/robots.txt | 2 + docs/sop/component.md | 411 ++ docs/sop/more.md | 11 + docs/sop/quickStart.md | 181 + docs/sop/style.md | 138 + package-lock.json | 5595 ++++++++++++++++++++++++++ package.json | 35 + 22 files changed, 6841 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 README.md create mode 100644 docs/.vitepress/blog-theme.ts create mode 100644 docs/.vitepress/config.mts create mode 100644 docs/.vitepress/theme/assets/bg.webp create mode 100644 docs/.vitepress/theme/index.ts create mode 100644 docs/.vitepress/theme/style.scss create mode 100644 docs/.vitepress/theme/user-theme.css create mode 100644 docs/about.md create mode 100644 docs/index.md create mode 100644 docs/public/.spa create mode 100644 docs/public/favicon.ico create mode 100644 docs/public/logo.png create mode 100644 docs/public/robots.txt create mode 100644 docs/sop/component.md create mode 100644 docs/sop/more.md create mode 100644 docs/sop/quickStart.md create mode 100644 docs/sop/style.md create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..66875e9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,99 @@ +name: Deploy Pages + +# 触发条件,push到main分支或者pull request到main分支 +on: + push: + branches: [main] + pull_request: + branches: [main] + + # 支持手动在工作流上触发 + workflow_dispatch: + +# 设置时区 +env: + TZ: Asia/Shanghai + +# 权限设置 +permissions: + # 允许读取仓库内容的权限。 + contents: read + # 允许写入 GitHub Pages 的权限。 + pages: write + # 允许写入 id-token 的权限。 + id-token: write + +# 并发控制配置 +concurrency: + group: pages + cancel-in-progress: false + +# 定义执行任务 +jobs: + # 构建任务 + build: + + runs-on: ubuntu-latest + + # node v20 运行 + strategy: + matrix: + node-version: [20] + + steps: + # 拉取代码 + - name: Checkout + uses: actions/checkout@v4 + with: + # 保留 Git 信息 + fetch-depth: 0 + + # 设置使用 Node.js 版本 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + # 使用 最新的 PNPM + # 你也可以指定为具体的版本 + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: latest + # version: 9 + run_install: false + + # 安装依赖 + - name: Install dependencies + run: pnpm install --no-frozen-lockfile + # 锁定依赖版本 + # run: pnpm install --frozen-lockfile + + # 构建项目 + - name: Build blog project + run: | + echo ${{ github.workspace }} + pnpm build + + # 资源拷贝 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./docs/.vitepress/dist + destination: ./_site + + # 上传 _site 的资源,用于后续部署 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # 部署任务 + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce7ca6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules +dist +cache +.temp +.DS_Store \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..319e41e --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +strict-peer-dependencies=false diff --git a/README.md b/README.md new file mode 100644 index 0000000..93880b9 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +
+简约风的 VitePress 博客主题 示例运行项目。 +
+ + + +## Usage + +先安装 `pnpm` + +```sh +npm i -g pnpm +``` + +安装依赖 + +```sh +pnpm install +``` + +开发启动 + +```sh +pnpm dev +``` + +构建 + +```sh +pnpm build +``` + +预览产物 + +```sh +pnpm serve +``` + +## Github Pages 部署 + +① Github Pages 开启 Git Actions 部署支持 + + + +② 复制文件 `.github/workflows/deploy.yml` 到自己的项目相同目录下 + +示例项目已包含,可以直接进行下一步 + +③ 修改 `docs/.vitepress/config.mts` 里的构建配置 + +**如果项目名已经为 name.github.io 域名,则不需要修改,保持默认值 `/` 即可** + +`base` 改为 `"/仓库名/"` 即可 + +```ts +// 省略无关代码 +const base = '/vitepress-blog-sugar-template/' +export default defineConfig({ + base, +}) +``` + +④ 推送 `main` 分支即可 + +需要进一步修改部署和构建配置,详见`deploy.yml` 文件。 diff --git a/docs/.vitepress/blog-theme.ts b/docs/.vitepress/blog-theme.ts new file mode 100644 index 0000000..8202714 --- /dev/null +++ b/docs/.vitepress/blog-theme.ts @@ -0,0 +1,105 @@ +// 主题独有配置 +import { getThemeConfig } from '@sugarat/theme/node' + +// 开启RSS支持(RSS配置) +// import type { Theme } from '@sugarat/theme' + +// const baseUrl = 'https://sugarat.top' +// const RSS: Theme.RSSOptions = { +// title: '粥里有勺糖', +// baseUrl, +// copyright: 'Copyright (c) 2018-present, 粥里有勺糖', +// description: '你的指尖,拥有改变世界的力量(大前端相关技术分享)', +// language: 'zh-cn', +// image: 'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTE2NzAzMA==674995167030', +// favicon: 'https://sugarat.top/favicon.ico', +// } + +// 所有配置项,详见文档: https://theme.sugarat.top/ +const blogTheme = getThemeConfig({ + // 开启RSS支持 + // RSS, + + // 搜索 + // 默认开启pagefind离线的全文搜索支持(如使用其它的可以设置为false) + // search: false, + + // 默认开启 markdown 图表支持(会增加一定的构建耗时) + // mermaid: false + + // 页脚 + footer: { + // message 字段支持配置为HTML内容,配置多条可以配置为数组 + // message: '下面 的内容和图标都是可以修改的噢(当然本条内容也是可以隐藏的)', + copyright: 'MIT License | 粥里有勺糖', + // icpRecord: { + // name: '蜀ICP备19011724号', + // link: 'https://beian.miit.gov.cn/' + // }, + // securityRecord: { + // name: '公网安备xxxxx', + // link: 'https://www.beian.gov.cn/portal/index.do' + // }, + }, + + // 主题色修改 + themeColor: 'el-blue', + + // 文章默认作者 + author: '粥里有勺糖', + + // 友链 + friend: [ + { + nickname: '粥里有勺糖', + des: '你的指尖用于改变世界的力量', + avatar: + 'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTE2NzAzMA==674995167030', + url: 'https://sugarat.top', + }, + { + nickname: 'Vitepress', + des: 'Vite & Vue Powered Static Site Generator', + avatar: + 'https://vitepress.dev/vitepress-logo-large.webp', + url: 'https://vitepress.dev/', + }, + ], + + // 公告 + popover: { + title: '公告', + body: [ + { type: 'text', content: '👇公众号👇---👇 微信 👇' }, + { + type: 'image', + src: 'https://img.cdn.sugarat.top/mdImg/MTYxNTAxODc2NTIxMA==615018765210~fmt.webp' + }, + { + type: 'text', + content: '欢迎大家加群&私信交流' + }, + { + type: 'text', + content: '文章首/文尾有群二维码', + style: 'padding-top:0' + }, + { + type: 'button', + content: '作者博客', + link: 'https://sugarat.top' + }, + { + type: 'button', + content: '加群交流', + props: { + type: 'success' + }, + link: 'https://theme.sugarat.top/group.html', + } + ], + duration: 0 + }, +}) + +export { blogTheme } diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts new file mode 100644 index 0000000..e02266d --- /dev/null +++ b/docs/.vitepress/config.mts @@ -0,0 +1,58 @@ +import { defineConfig } from 'vitepress' + +// 导入主题的配置 +import { blogTheme } from './blog-theme' + +// 如果使用 GitHub/Gitee Pages 等公共平台部署 +// 通常需要修改 base 路径,通常为“/仓库名/” +// 如果项目名已经为 name.github.io 域名,则不需要修改! +// const base = process.env.GITHUB_ACTIONS === 'true' +// ? '/vitepress-blog-sugar-template/' +// : '/' + +// Vitepress 默认配置 +// 详见文档:https://vitepress.dev/reference/site-config +export default defineConfig({ + // 继承博客主题(@sugarat/theme) + extends: blogTheme, + // base, + lang: 'zh-cn', + title: '@sugarat/theme', + description: '粥里有勺糖的博客主题,基于 vitepress 实现', + lastUpdated: true, + // 详见:https://vitepress.dev/zh/reference/site-config#head + head: [ + // 配置网站的图标(显示在浏览器的 tab 上) + // ['link', { rel: 'icon', href: `${base}favicon.ico` }], // 修改了 base 这里也需要同步修改 + ['link', { rel: 'icon', href: '/favicon.ico' }] + ], + themeConfig: { + // 展示 2,3 级标题在目录中 + outline: { + level: [2, 3], + label: '目录' + }, + // 默认文案修改 + returnToTopLabel: '回到顶部', + sidebarMenuLabel: '相关文章', + lastUpdatedText: '上次更新于', + + // 设置logo + logo: '/logo.png', + // editLink: { + // pattern: + // 'https://github.com/ATQQ/sugar-blog/tree/master/packages/blogpress/:path', + // text: '去 GitHub 上编辑内容' + // }, + nav: [ + { text: '首页', link: '/' }, + { text: '关于作者', link: 'https://sugarat.top/aboutme.html' } + ], + socialLinks: [ + { + icon: 'github', + link: 'https://github.com/ATQQ/sugar-blog/tree/master/packages/theme' + } + ] + } +}) diff --git a/docs/.vitepress/theme/assets/bg.webp b/docs/.vitepress/theme/assets/bg.webp new file mode 100644 index 0000000000000000000000000000000000000000..cc2c4d00087e4057315d897b75dcafadc1f37bb4 GIT binary patch literal 16282 zcmbWe1#n!w)~?xYW@cvQm?>sv=9rloW5>)KQ_ReE%*@Qp?3kI^9_M`joO5QX?wzTt zs@8tA^h#QLNxQ4Nb}c1IF|qis0D!uvkb;^5rv?lF0HFH(oPq#ufB;EhVFd}e&n5s) zLdL?@4g?7Ru(5S^R1y~=($Lf*f}8+=0H6U70A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