Skip to content

Commit 80d7e30

Browse files
committed
docs: add miscellaneous part
1 parent e231744 commit 80d7e30

File tree

10 files changed

+132
-229
lines changed

10 files changed

+132
-229
lines changed

Diff for: packages/docs/docs/.vuepress/nav/en.js

+13-37
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ module.exports = [
2424
{
2525
text: 'Options',
2626
link: '/plugin/#options'
27+
},
28+
{
29+
text: 'Official Plugins',
30+
link: '/plugin/official.html'
2731
}
2832
]
2933
},
@@ -32,15 +36,15 @@ module.exports = [
3236
items: [
3337
{
3438
text: 'Write a theme',
35-
link: '/theme/#writing-a-plugin'
39+
link: '/theme/#writing-a-theme'
3640
},
3741
{
3842
text: 'Using a theme',
39-
link: '/theme/#using-a-plugin'
43+
link: '/theme/#using-a-theme'
4044
},
4145
{
4246
text: 'Options',
43-
link: '/theme/api.html'
47+
link: '/theme/#options'
4448
},
4549
{
4650
text: 'Default Theme Config',
@@ -49,46 +53,18 @@ module.exports = [
4953
]
5054
},
5155
{
52-
text: 'Official Plugins',
56+
text: 'Miscellaneous',
5357
items: [
5458
{
55-
text: 'search',
56-
link: '/plugin/official.html#vuepress-search'
59+
text: 'Design Concepts',
60+
link: '/miscellaneous/design-concepts.html'
5761
},
5862
{
59-
text: 'pwa',
60-
link: '/plugin/official.html#vuepress-pwa'
61-
},
62-
{
63-
text: 'blog',
64-
link: '/plugin/official.html#vuepress-blog'
65-
},
66-
{
67-
text: 'pagination',
68-
link: '/plugin/official.html#vuepress-pagination'
69-
},
70-
{
71-
text: 'google-analytics',
72-
link: '/plugin/official.html#vuepress-google-analytics'
73-
},
74-
{
75-
text: 'i18n-ui',
76-
link: '/plugin/official.html#vuepress-i18n-ui'
77-
},
78-
{
79-
text: 'last-updated',
80-
link: '/plugin/official.html#vuepress-last-updated'
81-
},
82-
{
83-
text: 'medium-zoom',
84-
link: '/plugin/official.html#vuepress-medium-zoom'
85-
},
86-
{
87-
text: 'back-to-top',
88-
link: '/plugin/official.html#vuepress-back-to-top'
63+
text: 'Migrate from 0.x.x',
64+
link: '/miscellaneous/migration-guide.html'
8965
}
9066
]
91-
}
67+
},
9268
],
9369
},
9470
{

Diff for: packages/docs/docs/.vuepress/nav/zh.js

+12-36
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ module.exports = [
2424
{
2525
text: '插件的选项',
2626
link: '/zh/plugin/#options'
27+
},
28+
{
29+
text: '官方插件',
30+
link: '/plugin/official.html'
2731
}
2832
]
2933
},
@@ -32,11 +36,11 @@ module.exports = [
3236
items: [
3337
{
3438
text: '主题的开发',
35-
link: '/zh/theme/#writing-a-plugin'
39+
link: '/zh/theme/#writing-a-theme'
3640
},
3741
{
3842
text: '主题的使用',
39-
link: '/zh/theme/#using-a-plugin'
43+
link: '/zh/theme/#using-a-theme'
4044
},
4145
{
4246
text: '主题的选项',
@@ -49,46 +53,18 @@ module.exports = [
4953
]
5054
},
5155
{
52-
text: '官方插件',
56+
text: '了解更多',
5357
items: [
5458
{
55-
text: 'search',
56-
link: '/zh/plugin/official.html#vuepress-search'
59+
text: '设计理念',
60+
link: '/miscellaneous/design-concepts.html'
5761
},
5862
{
59-
text: 'pwa',
60-
link: '/zh/plugin/official.html#vuepress-pwa'
61-
},
62-
{
63-
text: 'blog',
64-
link: '/zh/plugin/official.html#vuepress-blog'
65-
},
66-
{
67-
text: 'pagination',
68-
link: '/zh/plugin/official.html#vuepress-pagination'
69-
},
70-
{
71-
text: 'google-analytics',
72-
link: '/zh/plugin/official.html#vuepress-google-analytics'
73-
},
74-
{
75-
text: 'i18n-ui',
76-
link: '/zh/plugin/official.html#vuepress-i18n-ui'
77-
},
78-
{
79-
text: 'last-updated',
80-
link: '/zh/plugin/official.html#vuepress-last-updated'
81-
},
82-
{
83-
text: 'medium-zoom',
84-
link: '/zh/plugin/official.html#vuepress-medium-zoom'
85-
},
86-
{
87-
text: 'back-to-top',
88-
link: '/zh/plugin/official.html#vuepress-back-to-top'
63+
text: '从 0.x.x 迁移',
64+
link: '/miscellaneous/migration-guide.html'
8965
}
9066
]
91-
}
67+
},
9268
],
9369
},
9470
{

Diff for: packages/docs/docs/config/README.md

+7-53
Original file line numberDiff line numberDiff line change
@@ -120,64 +120,18 @@ A function to control what files should have `<link rel="preload">` resource hin
120120

121121
## Styling
122122

123-
### palette
123+
### palette.styl
124124

125-
- Type: `Object|String`
126-
- Default: `undefined`
127-
128-
Set globally available stylus color variables.
129-
130-
If it is string, it needs to be a **absolute path** pointing to a stylus file that defines the color constant:
131-
132-
```js
133-
module.exports = {
134-
palette: path.resolve(__dirname, 'palette.styl'),
135-
}
136-
```
137-
138-
::: tip
139-
When `config.palette` is empty, vuepress will detect whether `.vuepress/palette.styl` exists. If it exists, the file will be used as palette.
140-
:::
141-
142-
If it is an object, it needs to be an object with key as the color name and value as the color value.
143-
144-
```js
145-
module.exports = {
146-
palette: {
147-
// Internal default color constants can be
148-
// modified to quickly modify global styles.
149-
$accentColor: '#3eaf7c',
150-
$textColor: '#2c3e50',
151-
$borderColor: '#eaecef',
152-
$codeBgColor: '#282c34',
153-
$arrowBgColor: '#ccc',
154-
155-
// Your extra colors
156-
$shadowColor: '#ddd'
157-
}
158-
}
159-
```
125+
Create a `.vuepress/style/palette.styl` file and it will be registered as global palette.
160126

161-
::: tip
162-
It is worth noting that `modifying global style` via `palette` depends on the strict use of the default palette for your theme (e.g. the `@vuepress/theme-default` you see now).
163-
:::
164-
165-
### style
166-
167-
- Type: `string`
168-
- Default: `undefined`
127+
### index.styl
169128

170-
Extra style file.
129+
Create a `.vuepress/style/index.styl` file and it will be applied as global styles.
171130

172-
```js
173-
module.exports = {
174-
style: path.resolve(__dirname, 'style.styl'),
175-
}
176-
```
131+
**Also see:**
177132

178-
::: tip
179-
When `config.style` is empty, vuepress will detect whether `.vuepress/style.styl` exists. If it exists, the file will be applied automatically.
180-
:::
133+
- [Why can't `palette.styl` and `index.styl` merge into one API?](faq/#why-can-t-palette-styl-and-index-styl-merge-into-one-api)
134+
- [Why can't `palette.styl` and `index.styl` merge into one API?](faq/#why-can-t-palette-styl-and-index-styl-merge-into-one-api)
181135

182136
## Theming
183137

Diff for: packages/docs/docs/miscellaneous/design-concepts.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
sidebar: auto
3+
---
4+
5+
# Design Concepts of VuePress 1.0
6+
7+
- TODO
8+
9+
10+

Diff for: packages/docs/docs/miscellaneous/migration-guide.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sidebar: auto
3+
---
4+
5+
# Migration from 0.x.x
6+
7+
- TODO

Diff for: packages/docs/docs/plugin/official.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
sidebar: auto
33
---
44

5+
- TODO
6+
57
# Official Plugins
68

79
## @vuepress/search

Diff for: packages/docs/docs/theme/README.md

-103
Original file line numberDiff line numberDiff line change
@@ -247,106 +247,3 @@ See: [Config > plugins](../config/README.md#plugins).
247247
- Default: undefined
248248

249249
See: [Config > palette](../config/README.md#palette).
250-
251-
## Design Concepts
252-
253-
Senior users have found that both theme developers and regular users have the ability to customize global `palettes`, `styles`, `templates` and `plugins`, so how do they work together?
254-
255-
### Loading Priority
256-
257-
For `templates/*`, follow the certain loading priority. Taking `templates/ssr.html` as an example:
258-
259-
@flowstart
260-
cond1=>condition: User's ssr.html
261-
exists?
262-
cond2=>condition: Theme's ssr.html
263-
exists?
264-
stage1=>operation: Using user's ssr.html
265-
stage2=>operation: Using theme's ssr.html
266-
stage3=>operation: Using default ssr.html
267-
268-
cond1(no, right)->cond2(no)->stage3
269-
cond1(yes, bottom)->stage1
270-
cond2(yes, bottom)->stage2
271-
@flowend
272-
273-
::: warning Note
274-
When customizing `templates/ssr.html`, or `templates/dev.html`, it is best to modify it on the basis of the [default template files](https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/app/index.dev.html), otherwise it may cause a build failure.
275-
:::
276-
277-
### Overriding
278-
279-
For `palette.styl`, `index.styl` and `plugins`, follow the principles of overriding:
280-
281-
#### palette.styl
282-
283-
User's `styles/palette.styl` has a higher priority than the theme's `styles/palette.styl`, so the theme can define its own palette and the user can tweak it. e.g.
284-
285-
```stylus
286-
// theme/styles/palette.styl
287-
$accentColor = #0f0
288-
```
289-
290-
```stylus
291-
// .vuepress/styles/palette.styl
292-
$accentColor = #f00
293-
```
294-
295-
So the final value of `$accentColor` is `#f00`.
296-
297-
#### index.styl
298-
299-
Both the user's `styles/index.styl` and the theme's `styles/index.styl` are generated into the final `CSS` file, but the user's style is generated later and therefore has higher priority. e.g.
300-
301-
```stylus
302-
// theme/styles/index.styl
303-
.content
304-
font-size 14px
305-
```
306-
307-
```stylus
308-
// .vuepress/styles/index.styl
309-
.content
310-
font-size 15px
311-
```
312-
313-
The final generated CSS is as follows:
314-
315-
```css
316-
/* theme/styles/index.styl */
317-
.content {
318-
font-size: 14px;
319-
}
320-
321-
/* theme/styles/index.styl */
322-
.content {
323-
font-size: 15px;
324-
}
325-
```
326-
327-
#### plugins
328-
329-
Since all plugins with the same name can be applied ONLY once by default, users can override the default options for plugins in theme. e.g.
330-
331-
```js
332-
// theme/index.js
333-
module.exports = {
334-
plugins: [
335-
'@vuepress/i18n-ui',
336-
{ route: '/i18n-page/' }
337-
]
338-
}
339-
```
340-
341-
```js
342-
// .vuepress/config.js
343-
module.exports = {
344-
plugins: [
345-
'@vuepress/i18n-ui',
346-
{ route: '/i18n/' }
347-
]
348-
}
349-
```
350-
351-
Then the final route of i18n UI is `/i18n-ui/`.
352-

0 commit comments

Comments
 (0)