Skip to content

Commit

Permalink
feat(vuepress-demo): 增加@142vip/vuepress模块的演示示例,降低配置难度
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Oct 4, 2024
1 parent eb0341b commit 748b7d0
Show file tree
Hide file tree
Showing 18 changed files with 453 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/vuepress-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# vuepress-demo

## 介绍

## 证书

[MIT](https://opensource.org/license/MIT)

Copyright (c) 2019-present, 142vip 储凡
4 changes: 4 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# vuepress 目录规范

- `styles` 目录固定
- `public` 目录固定
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/styles/config.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 参考:https://theme-hope.vuejs.press/zh/config/style.html

// 浅色主题
//ateliersulphurpool-light
//coldark-cold
//coy
//duotone-light
//ghcolors
//gruvbox-light
//material-light
//one-light
//vs
//$code-light-theme: 'coldark-cold';
//
//// 深色主题
//$code-dark-theme: 'atom-dark';

// 主题色 配合outlook显示
$theme-color: #fb9b5f;
//$theme-colors: #2196f3, #f26d6d, #3eaf7c, #fb9b5f;
128 changes: 128 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/styles/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/* 此处自定义样式,对主题进行覆盖 */

// 全站主题色
:root {
// brand colors
// --c-brand: #3eaf7c;
// --c-brand-light: #4abf8a;

--c-brand: #4ce9ad;
--c-brand-light: #42b983;

// background colors
--c-bg: #ffffff;
--c-bg-light: #f3f4f5;
--c-bg-lighter: #eeeeee;
--c-bg-navbar: var(--c-bg);
--c-bg-sidebar: var(--c-bg);
--c-bg-arrow: #cccccc;

// text colors
--c-text: #2c3e50;
--c-text-accent: var(--c-brand);
--c-text-light: #3a5169;
--c-text-lighter: #4e6e8e;
--c-text-lightest: #6a8bad;
--c-text-quote: #999999;

// border colors
--c-border: #eaecef;
--c-border-dark: #dfe2e5;

// custom container colors
--c-tip: #42b983;
--c-tip-bg: var(--c-bg-light);
--c-tip-title: var(--c-text);
--c-tip-text: var(--c-text);
--c-tip-text-accent: var(--c-text-accent);
--c-warning: #e7c000;
--c-warning-bg: #fffae3;
--c-warning-title: #ad9000;
--c-warning-text: #746000;
--c-warning-text-accent: var(--c-text);
--c-danger: #cc0000;
--c-danger-bg: #ffe0e0;
--c-danger-title: #990000;
--c-danger-text: #660000;
--c-danger-text-accent: var(--c-text);
--c-details-bg: #eeeeee;

// badge component colors
--c-badge-tip: var(--c-tip);
--c-badge-warning: var(--c-warning);
--c-badge-danger: var(--c-danger);

// transition vars
--t-color: 0.3s ease;
--t-transform: 0.3s ease;

// code blocks vars
--code-bg-color: #282c34;
--code-hl-bg-color: rgba(0, 0, 0, 0.66);
--code-ln-color: #9e9e9e;
--code-ln-wrapper-width: 3.5rem;

// font vars
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans',
'Droid Sans', 'Helvetica Neue', sans-serif;
--font-family-code: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;

// layout vars
--navbar-height: 3.6rem;
--navbar-padding-v: 0.7rem;
--navbar-padding-h: 1.5rem;
--sidebar-width: 20rem;
--sidebar-width-mobile: calc(var(--sidebar-width) * 0.82);
--content-width: 740px;
--homepage-width: 960px;
}

// plugin-docsearch
.DocSearch {
--docsearch-primary-color: var(--c-brand);
--docsearch-text-color: var(--c-text);
--docsearch-highlight-color: var(--c-brand);
--docsearch-muted-color: var(--c-text-quote);
--docsearch-container-background: rgba(9, 10, 17, 0.8);
--docsearch-modal-background: var(--c-bg-light);
--docsearch-searchbox-background: var(--c-bg-lighter);
--docsearch-searchbox-focus-background: var(--c-bg);
--docsearch-searchbox-shadow: inset 0 0 0 2px var(--c-brand);
--docsearch-hit-color: var(--c-text-light);
--docsearch-hit-active-color: var(--c-bg);
--docsearch-hit-background: var(--c-bg);
--docsearch-hit-shadow: 0 1px 3px 0 var(--c-border-dark);
--docsearch-footer-background: var(--c-bg);
}

// plugin-external-link-icon
.external-link-icon {
--external-link-icon-color: var(--c-text-quote);
}

// plugin-medium-zoom
.medium-zoom-overlay {
--medium-zoom-bg-color: var(--c-bg);
}

// plugin-pwa-popup
.pwa-popup {
--pwa-popup-text-color: var(--c-text);
--pwa-popup-bg-color: var(--c-bg);
--pwa-popup-border-color: var(--c-brand);
--pwa-popup-shadow: 0 4px 16px var(--c-brand);
--pwa-popup-btn-text-color: var(--c-bg);
--pwa-popup-btn-bg-color: var(--c-brand);
--pwa-popup-btn-hover-bg-color: var(--c-brand-light);
}

// plugin-search
.search-box {
--search-bg-color: var(--c-bg);
--search-accent-color: var(--c-brand);
--search-text-color: var(--c-text);
--search-border-color: var(--c-border);

--search-item-text-color: var(--c-text-lighter);
--search-item-focus-bg-color: var(--c-bg-light);
}
4 changes: 4 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/styles/palette.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//$sidebar-width: 20rem;
//$sidebar-mobile-width: 16rem;
//$content-width: 75rem;
$home-page-width: 80rem;
5 changes: 5 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/theme/READEME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 自定义布局

## 参考

- <https://vuejs.press/zh/reference/frontmatter.html#layout>
51 changes: 51 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/theme/navbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { navbar } from 'vuepress-theme-hope'

/**
* 导航栏配置
*/
export default navbar([
{
text: '🌐 首页',
link: '/',
},
{
text: '💻 示例文档',
children: [
{
text: '👩🏻‍💻 示例文档-1',
link: '/example/test-1.md',
},
{
text: '👨🏻‍💻 示例文档-2',
link: '/example/test-2.md',
},
{
text: '👨🏻 示例文档-3',
link: '/example/test-3.md',
},
],
},
{
text: '👉 了解更多',
children: [
{
text: '📄 更新日志',
link: '/changelog',
},
{
text: '开源博客',
children: [
{
text: '🤡 408CSFamily',
link: 'https://142vip-cn.feishu.cn/share/base/view/shrcnuuRDWBoHLmYaknXWFuhR4d',
},
{
text: '📘 JavaScriptCollection',
link: 'https://142vip.github.io/JavaScriptCollection/',
},
],
},

],
},
])
28 changes: 28 additions & 0 deletions apps/vuepress-demo/docs/.vuepress/theme/sidebar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { sidebar } from 'vuepress-theme-hope'

/**
* 侧边栏配置
*/
export default sidebar({
'/example': [
{
text: '示例文档',
// prefix: 'example',
collapsible: false,
children: [
{
text: '示例文档-1',
link: 'test-1.md',
},
{
text: '示例文档-2',
link: 'test-2.md',
},
{
text: '示例文档-3',
link: 'test-3.md',
},
],
},
],
})
52 changes: 52 additions & 0 deletions apps/vuepress-demo/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
home: true
title: 首页
heroText: vuepress-demo
tagline: "@142vip/vuepress包的使用Demo演示"
actions:
- text: 示例文档-1
link: /example/test-1.md
type: primary
- text: 示例文档-2
link: /example/test-2.md
type: secondary
- text: 示例文档-3
link: /example/test-3.md
type: secondary
features:
- title: VuePress官网
details: Vue 驱动的静态网站生成器
link: https://v2.vuepress.vuejs.org/zh/
- title: Hope主题
details: vuepress-theme-hope
link: https://theme-hope.vuejs.press/
- title: "@142vip/vuepress"
details: 基于vuepress框架和vuepress-theme-hope主题封装
link: https://www.npmjs.com/package/@142vip/vuepress
---

## 下载依赖

```bash:no-line-numbers
# 安装vuepress
pnpm i vuepress -D
# 安装vite-bundle编译模块
pnpm i @vuepress/bundler-vite -D
# 安装@142vip/vuepress模块
pnpm i @142vip/vuepress -D
```

## 基本使用

```bash:no-line-numbers
# 进入vuepress-demo根目录
cd apps/vuepress-demo
# 启动项目
pnpm dev
# 编译
pnpm build
```
3 changes: 3 additions & 0 deletions apps/vuepress-demo/docs/example/test-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 示例文档-1

这里是`示例文档-1`,内容随便写写
3 changes: 3 additions & 0 deletions apps/vuepress-demo/docs/example/test-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 示例文档-2

这里是`示例文档-2`,内容随便写写
3 changes: 3 additions & 0 deletions apps/vuepress-demo/docs/example/test-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 示例文档-3

这里是`示例文档-3`,内容随便写写
23 changes: 23 additions & 0 deletions apps/vuepress-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "vuepress-demo",
"type": "module",
"version": "0.0.1-alpha.0",
"private": true,
"packageManager": "pnpm@9.6.0",
"description": "研究生考试408考点、工作面试计算机基础知识合集",
"authorInfo": {
"name": "微信公众号:储凡",
"email": "fairy_vip@2925.com",
"url": "https://github.com/142vip",
"homePage": "https://142vip.cn"
},
"scripts": {
"dev": "vuepress dev docs --clean-cache",
"build": "vuepress build docs"
},
"devDependencies": {
"@142vip/vuepress": "workspace:*",
"@vuepress/bundler-vite": "2.0.0-rc.15",
"vuepress": "2.0.0-rc.15"
}
}
38 changes: 38 additions & 0 deletions apps/vuepress-demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"compileOnSave": true,
"compilerOptions": {
"target": "es2018",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"module": "commonjs",
"moduleResolution": "node",
"paths": {
"@theme/*": [
".vitepress/theme/*"
],
"@packages/*": [
"packages/*"
]
},
"typeRoots": [
"./typings",
"./node_modules/@types"
],
"strictNullChecks": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"declaration": true,
"inlineSourceMap": true,
"stripInternal": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"pretty": true
},
"exclude": [
"dist",
"node_modules",
"test"
]
}
7 changes: 7 additions & 0 deletions apps/vuepress-demo/vuepress.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineClientConfig } from '@vuepress/client'

export default defineClientConfig({
enhance() {},
setup() {},
rootComponents: [],
})
Loading

0 comments on commit 748b7d0

Please sign in to comment.