Skip to content

Commit 1a928c7

Browse files
meteorlxyulivz
authored andcommitted
feat($plugin-nprogress): allow nprogress use different color and add docs (#1366)
1 parent 5a111a2 commit 1a928c7

File tree

4 files changed

+85
-4
lines changed

4 files changed

+85
-4
lines changed

packages/@vuepress/plugin-nprogress/nprogress.styl

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
$nprogressColor ?= $accentColor
2+
13
#nprogress
24
pointer-events none
35
.bar
4-
background $accentColor
6+
background $nprogressColor
57
position fixed
68
z-index 1031
79
top 0
@@ -14,7 +16,7 @@
1416
right 0px
1517
width 100px
1618
height 100%
17-
box-shadow 0 0 10px $accentColor, 0 0 5px $accentColor
19+
box-shadow 0 0 10px $nprogressColor, 0 0 5px $nprogressColor
1820
opacity 1.0
1921
transform rotate(3deg) translate(0px, -4px)
2022
.spinner
@@ -28,8 +30,8 @@
2830
height 18px
2931
box-sizing border-box
3032
border solid 2px transparent
31-
border-top-color $accentColor
32-
border-left-color $accentColor
33+
border-top-color $nprogressColor
34+
border-left-color $nprogressColor
3335
border-radius 50%
3436
animation nprogress-spinner 400ms linear infinite
3537

packages/docs/docs/.vuepress/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function getGuideSidebar (groupA, groupB) {
120120
const officalPlugins = fs
121121
.readdirSync(path.resolve(__dirname, '../plugin/official'))
122122
.map(filename => 'official/' + filename.slice(0, -3))
123+
.sort()
123124

124125
function getPluginSidebar (pluginTitle, pluginIntro, officialPluginTitle) {
125126
return [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: nprogress
3+
metaTitle: Nprogress Plugin | VuePress
4+
---
5+
6+
# [@vuepress/plugin-nprogress](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-nprogress)
7+
8+
> Nprogress plugin
9+
10+
## Install
11+
12+
```bash
13+
yarn add -D @vuepress/plugin-nprogress
14+
# OR npm install -D @vuepress/plugin-nprogress
15+
```
16+
17+
## Usage
18+
19+
```javascript
20+
module.exports = {
21+
plugins: ['@vuepress/nprogress']
22+
}
23+
```
24+
25+
## Custom color
26+
27+
Set `$nprogressColor` in your __site__ or __theme__ `palette.styl` file to change the color of the progress bar (default is `$accentColor`).
28+
29+
```stylus
30+
// .vuepress/styles/palette.styl
31+
// or
32+
// .vuepress/theme/styles/palette.styl
33+
34+
$nprogressColor = red
35+
```
36+
37+
**Also see:**
38+
39+
- [Config Reference > Styling](../../config/#styling)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: nprogress
3+
metaTitle: Nprogress 插件 | VuePress
4+
---
5+
6+
# [@vuepress/plugin-nprogress](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-nprogress)
7+
8+
> Nprogress plugin
9+
10+
## 安装
11+
12+
```bash
13+
yarn add -D @vuepress/plugin-nprogress
14+
# 或者 npm install -D @vuepress/plugin-nprogress
15+
```
16+
17+
## 使用
18+
19+
```javascript
20+
module.exports = {
21+
plugins: ['@vuepress/nprogress']
22+
}
23+
```
24+
25+
## 自定义颜色
26+
27+
在你的 __site____theme__`palette.styl` 文件中设置 `$nprogressColor` 来改变进度条的颜色(默认使用 `$accentColor`)。
28+
29+
```stylus
30+
// .vuepress/styles/palette.styl
31+
// 或者
32+
// .vuepress/theme/styles/palette.styl
33+
34+
$nprogressColor = red
35+
```
36+
37+
**参考:**
38+
39+
- [配置 > Styling](../../config/#styling)

0 commit comments

Comments
 (0)