Skip to content

Commit

Permalink
feat($plugin-nprogress): allow nprogress use different color and add …
Browse files Browse the repository at this point in the history
…docs (#1366)
  • Loading branch information
meteorlxy authored and ulivz committed Mar 2, 2019
1 parent 5a111a2 commit 1a928c7
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/@vuepress/plugin-nprogress/nprogress.styl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
$nprogressColor ?= $accentColor

#nprogress
pointer-events none
.bar
background $accentColor
background $nprogressColor
position fixed
z-index 1031
top 0
Expand All @@ -14,7 +16,7 @@
right 0px
width 100px
height 100%
box-shadow 0 0 10px $accentColor, 0 0 5px $accentColor
box-shadow 0 0 10px $nprogressColor, 0 0 5px $nprogressColor
opacity 1.0
transform rotate(3deg) translate(0px, -4px)
.spinner
Expand All @@ -28,8 +30,8 @@
height 18px
box-sizing border-box
border solid 2px transparent
border-top-color $accentColor
border-left-color $accentColor
border-top-color $nprogressColor
border-left-color $nprogressColor
border-radius 50%
animation nprogress-spinner 400ms linear infinite

Expand Down
1 change: 1 addition & 0 deletions packages/docs/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ function getGuideSidebar (groupA, groupB) {
const officalPlugins = fs
.readdirSync(path.resolve(__dirname, '../plugin/official'))
.map(filename => 'official/' + filename.slice(0, -3))
.sort()

function getPluginSidebar (pluginTitle, pluginIntro, officialPluginTitle) {
return [
Expand Down
39 changes: 39 additions & 0 deletions packages/docs/docs/plugin/official/plugin-nprogress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: nprogress
metaTitle: Nprogress Plugin | VuePress
---

# [@vuepress/plugin-nprogress](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-nprogress)

> Nprogress plugin
## Install

```bash
yarn add -D @vuepress/plugin-nprogress
# OR npm install -D @vuepress/plugin-nprogress
```

## Usage

```javascript
module.exports = {
plugins: ['@vuepress/nprogress']
}
```

## Custom color

Set `$nprogressColor` in your __site__ or __theme__ `palette.styl` file to change the color of the progress bar (default is `$accentColor`).

```stylus
// .vuepress/styles/palette.styl
// or
// .vuepress/theme/styles/palette.styl
$nprogressColor = red
```

**Also see:**

- [Config Reference > Styling](../../config/#styling)
39 changes: 39 additions & 0 deletions packages/docs/docs/zh/plugin/official/plugin-nprogress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: nprogress
metaTitle: Nprogress 插件 | VuePress
---

# [@vuepress/plugin-nprogress](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-nprogress)

> Nprogress plugin
## 安装

```bash
yarn add -D @vuepress/plugin-nprogress
# 或者 npm install -D @vuepress/plugin-nprogress
```

## 使用

```javascript
module.exports = {
plugins: ['@vuepress/nprogress']
}
```

## 自定义颜色

在你的 __site____theme__`palette.styl` 文件中设置 `$nprogressColor` 来改变进度条的颜色(默认使用 `$accentColor`)。

```stylus
// .vuepress/styles/palette.styl
// 或者
// .vuepress/theme/styles/palette.styl
$nprogressColor = red
```

**参考:**

- [配置 > Styling](../../config/#styling)

0 comments on commit 1a928c7

Please sign in to comment.