Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat($plugin-nprogress): allow nprogress use different color and add docs #1366

Merged
merged 3 commits into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)