1.优化文件结构2.增加redeme.md

This commit is contained in:
recoluan 2018-10-08 00:03:12 +08:00
parent 53666566fa
commit 361f28b0d4
24 changed files with 345 additions and 53 deletions

View File

@ -54,12 +54,12 @@
<script>
import Vue from 'vue'
import nprogress from 'nprogress'
import Home from './Home.vue'
import Navbar from './Navbar.vue'
import Page from './Page.vue'
import Sidebar from './Sidebar.vue'
import SWUpdatePopup from './SWUpdatePopup.vue'
import { resolveSidebarItems } from './util'
import Home from './components/Home/'
import Navbar from './components/Navbar/'
import Page from './components/Page/'
import Sidebar from './components/Sidebar/'
import SWUpdatePopup from './components/SWUpdatePopup/'
import { resolveSidebarItems } from './util/'
export default {
components: { Home, Page, Sidebar, Navbar, SWUpdatePopup },

150
README.md
View File

@ -1,3 +1,149 @@
vuepress-theme-reco
# vuepress-theme-reco
this is a theme for vuepress
[中文文档](./README_zh.md)
> 1. This is a vuepress theme aimed at adding the categories, TAB walls, pagination, comments and other features required for blogging;<br>
> 2. The theme itself is minimalist and is modified based on the default theme of the vuepress.
## Installation and use
1. Installation
```bash
npm install vuepress-theme-reco -dev--save
# or
yarn add vuepress-theme-reco
```
2. use
```javscript
// 修改 /docs/.vuepress/config.js
module.exports = {
theme: 'reco'
}
```
## add categories
**f want to add a `front-end` and `back-end` classification, need to undertake the following steps**
1. Add a category drop button to the top navigation
```javscript
// change /docs/.vuepress/config.js
module.exports = {
theme: 'reco',
themeConfig: {
nav: [
{ text: 'categories',
items: [
{ text: 'frontEnd', link: '/categories/frontEnd' },
{ text: 'backEnd', link: '/categories/backEnd' }
]
}
]
}
}
```
2. Add the files needed for classification
**`/docs/categories/frontEnd.md`**
```
---
title: frontEnd
isCategories: true
sidebar: false
---
## frontEnd
```
**`/docs/categories/backEnd.md`**
```
---
title: backEnd
isCategories: true
sidebar: false
---
## backEnd
```
> Why do you set sidebar false? Because you enable classification, that's a little bit of a conflict with the custom sidebar feature, so you globally turn on the auto sidebar feature, and then close it where you don't need a side marker
3. Add categories when writing articles
```
---
title: 【vue】跨域解决方案之proxyTable
date: 2017-12-28 23:39:45
categories: frontEnd
---
```
## Add tag cloud
1. Add a button to the top navigation
```javscript
// change /docs/.vuepress/config.js
module.exports = {
theme: 'reco',
themeConfig: {
nav: [
{ text: 'Tags', link: '/tags/' }
]
}
}
```
2. Add the required files
**`/docs/tags/README.md`**
```
---
isTags: true
sidebar: false
---
## tag cloud
```
3. Add tags when writing articles
```
---
title: 【vue】跨域解决方案之proxyTable
date: 2017-12-28 23:39:45
tags:
- vue
- webpack
---
```
## comment(valine)
Theme with a built-in valine comments, if you want to open this function, only configure your `config.js`
```javscript
// change /docs/.vuepress/config.js
module.exports = {
theme: 'reco',
themeConfig: {
// valine
valineConfig: {
appId: '...',// your appId
appKey: '...', // your appKey
}
}
}
```

147
README_zh.md Normal file
View File

@ -0,0 +1,147 @@
# vuepress-theme-reco
> 1. 这是一个vuepress主题目的是增加博客所需要的分类、标签墙、分页、评论等功能;<br>
> 2. 主题本身追求极简是在vuepress默认主题的基础上进行修改的。
## 安装和使用
1. 安装
```bash
npm install vuepress-theme-reco -dev--save
# 或
yarn add vuepress-theme-reco
```
2. 使用
```javscript
// 修改 /docs/.vuepress/config.js
module.exports = {
theme: 'reco'
}
```
## 增加分类功能
**假如想增加一个 `前端``后端` 分类,需要进行以下几步操作:**
1. 在顶部导航添加一个分类的下拉按钮
```javscript
// 修改 /docs/.vuepress/config.js
module.exports = {
theme: 'reco',
themeConfig: {
nav: [
{ text: '分类',
items: [
{ text: '前端', link: '/categories/frontEnd' },
{ text: '后端', link: '/categories/backEnd' }
]
}
]
}
}
```
2. 添加前端和后端的分类所需要的文件
**`/docs/categories/frontEnd.md`**
```
---
title: 前端
isCategories: true
sidebar: false
---
## 前端
```
**`/docs/categories/backEnd.md`**
```
---
title: 后端
isCategories: true
sidebar: false
---
## 后端
```
> 为什么设置sidebar: false因为启用分类功能那就跟自定义侧边栏功能有些冲突了所以全局开启了自动生成侧边栏功能然后在这种不需要侧标兰的地方关闭
3. 写文章时添加分类
```
---
title: 【vue】跨域解决方案之proxyTable
date: 2017-12-28 23:39:45
categories: frontEnd
---
```
## 添加标签云功能
1. 在顶部导航添加一个按钮
```javscript
// 修改 /docs/.vuepress/config.js
module.exports = {
theme: 'reco',
themeConfig: {
nav: [
{ text: 'Tags', link: '/tags/' }
]
}
}
```
2. 添加所需要的文件
**`/docs/tags/README.md`**
```
---
isTags: true
sidebar: false
---
## 标签墙
```
3. 写文章时添加标签
```
---
title: 【vue】跨域解决方案之proxyTable
date: 2017-12-28 23:39:45
tags:
- vue
- webpack
---
```
## 评论功能(valine)
主题内置valine评论功能如果想开启此功能仅需配置一下 `config.js`
```javscript
// 修改 /docs/.vuepress/config.js
module.exports = {
theme: 'reco',
themeConfig: {
// valine配置
valineConfig: {
appId: '...',// your appId
appKey: '...', // your appKey
}
}
}
```

View File

@ -59,7 +59,7 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.algolia-search-wrapper
& > span

View File

@ -12,8 +12,8 @@
</template>
<script>
import NoteAbstract from './components/noteAbstract'
import Pagation from './components/pagation'
import NoteAbstract from '../NoteAbstract/'
import Pagation from '../Pagation/'
export default {
@ -61,8 +61,8 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@require './styles/wrapper.styl'
@import '../../styles/config.styl'
@require '../../styles/wrapper.styl'
.categories-wrapper
max-width: 740px;

View File

@ -50,8 +50,8 @@
</template>
<script>
import NavLink from './NavLink.vue'
import DropdownTransition from './DropdownTransition.vue'
import NavLink from '../NavLink/'
import DropdownTransition from '../DropdownTransition/'
export default {
components: { NavLink, DropdownTransition },
@ -77,7 +77,7 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.dropdown-wrapper
cursor pointer

View File

@ -50,7 +50,7 @@
</template>
<script>
import NavLink from './NavLink.vue'
import NavLink from '../NavLink/'
export default {
components: { NavLink },
@ -71,7 +71,7 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.home
padding $navbarHeight 2rem 0

View File

@ -18,7 +18,7 @@
</template>
<script>
import { isExternal, isMailto, isTel, ensureExt } from './util'
import { isExternal, isMailto, isTel, ensureExt } from '../../util/'
export default {
props: {

View File

@ -34,9 +34,9 @@
</template>
<script>
import DropdownLink from './DropdownLink.vue'
import { resolveNavLinkItem } from './util'
import NavLink from './NavLink.vue'
import DropdownLink from '../DropdownLink/'
import { resolveNavLinkItem } from '../../util/'
import NavLink from '../NavLink/'
export default {
components: { NavLink, DropdownLink },
@ -116,7 +116,7 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.nav-links
display inline-block

View File

@ -37,10 +37,10 @@
</template>
<script>
import SidebarButton from './SidebarButton.vue'
import AlgoliaSearchBox from '@AlgoliaSearchBox'
import SearchBox from './SearchBox.vue'
import NavLinks from './NavLinks.vue'
import SidebarButton from '../SidebarButton/'
import AlgoliaSearchBox from '../AlgoliaSearchBox/'
import SearchBox from '../SearchBox/'
import NavLinks from '../NavLinks/'
export default {
components: { SidebarButton, NavLinks, SearchBox, AlgoliaSearchBox },
@ -86,7 +86,7 @@ function css (el, property) {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
$navbar-vertical-padding = 0.7rem
$navbar-horizontal-padding = 1.5rem

View File

@ -1,9 +1,8 @@
<template>
<div class="page">
<slot name="top"/>
<Content :custom="false"/>
<categories @currentTag="getCurrentTag"></categories>
<categories v-if="isCategories" @currentTag="getCurrentTag"></categories>
<valine v-if="!isCategories && !isTags"></valine>
<tags v-if="isTags" :tag="currentTag"></tags>
@ -65,10 +64,10 @@
</template>
<script>
import { resolvePage, normalize, outboundRE, endingSlashRE } from './util'
import Categories from './Categories'
import Valine from './components/valine'
import Tags from './Tags'
import { resolvePage, normalize, outboundRE, endingSlashRE } from '../../util/'
import Categories from '../Categories/'
import Valine from '../Valine/'
import Tags from '../Tags/'
export default {
data () {
@ -221,8 +220,8 @@ function find (page, items, offset) {
</script>
<style lang="stylus">
@import './styles/config.styl'
@require './styles/wrapper.styl'
@import '../../styles/config.styl'
@require '../../styles/wrapper.styl'
.page
padding-bottom 2rem

View File

@ -59,7 +59,7 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.sw-update-popup
position fixed

View File

@ -153,7 +153,7 @@ export default {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.search-box
display inline-block
@ -171,7 +171,7 @@ export default {
padding 0 0.5rem 0 2rem
outline none
transition all .2s ease
background #fff url(./search.svg) 0.6rem 0.5rem no-repeat
background #fff url(../../images/search.svg) 0.6rem 0.5rem no-repeat
background-size 1rem
&:focus
cursor auto

View File

@ -20,10 +20,10 @@
</template>
<script>
import SidebarGroup from './SidebarGroup.vue'
import SidebarLink from './SidebarLink.vue'
import NavLinks from './NavLinks.vue'
import { isActive } from './util'
import SidebarGroup from '../SidebarGroup/'
import SidebarLink from '../SidebarLink/'
import NavLinks from '../NavLinks/'
import { isActive } from '../../util/'
export default {
components: { SidebarGroup, SidebarLink, NavLinks },
@ -79,7 +79,7 @@ function resolveOpenGroupIndex (route, items) {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.sidebar
ul

View File

@ -7,7 +7,7 @@
</template>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.sidebar-button
display none

View File

@ -32,8 +32,8 @@
</template>
<script>
import SidebarLink from './SidebarLink.vue'
import DropdownTransition from './DropdownTransition.vue'
import SidebarLink from '../SidebarLink/'
import DropdownTransition from '../DropdownTransition/'
export default {
name: 'SidebarGroup',

View File

@ -1,5 +1,5 @@
<script>
import { isActive, hashRE, groupHeaders } from './util'
import { isActive, hashRE, groupHeaders } from '../../util/'
export default {
functional: true,
@ -59,7 +59,7 @@ function renderChildren (h, children, path, route, maxDepth, depth = 1) {
</script>
<style lang="stylus">
@import './styles/config.styl'
@import '../../styles/config.styl'
.sidebar .sidebar-sub-headers
padding-left 1rem

View File

@ -20,8 +20,8 @@
</template>
<script>
import NoteAbstract from './components/noteAbstract'
import Pagation from './components/pagation'
import NoteAbstract from '../NoteAbstract/'
import Pagation from '../Pagation/'
export default {
@ -92,8 +92,8 @@ export default {
</script>
<style lang="stylus" scoped>
@import './styles/config.styl'
@require './styles/wrapper.styl'
@import '../../styles/config.styl'
@require '../../styles/wrapper.styl'
.tags-wrapper
max-width: 740px;

View File

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 216 B