Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit c2d0a7c

Browse files
chrisvfritzznck
authored andcommitted
chore: Various doc recommendations (#222)
* various doc recommendations * chore: Fix getting started link and remove examples and options from main nav
1 parent 3c3b92e commit c2d0a7c

File tree

8 files changed

+4166
-163
lines changed

8 files changed

+4166
-163
lines changed

docs/.vuepress/config.js

+8-14
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,25 @@ module.exports = {
1717
label: 'English',
1818
selectText: 'Languages',
1919
editLinkText: 'Edit this page on GitHub',
20-
nav: [{
21-
text: 'Guide',
22-
link: '/guide/'
23-
},
20+
nav: [
2421
{
25-
text: 'Options Reference',
26-
link: '/options'
22+
text: 'Getting Started',
23+
link: '/getting-started'
2724
},
2825
{
2926
text: 'Migrating from v2',
3027
link: '/migrating'
31-
},
32-
{
33-
text: 'Cookbook',
34-
link: '/cookbook/'
3528
}
3629
],
3730
sidebar: [
38-
'/',
39-
'/guide/',
31+
{
32+
title: 'Guide',
33+
children: ['/', '/getting-started', '/examples']
34+
},
4035
'/options',
41-
'/cookbook/',
4236
'/changelog'
4337
]
4438
}
4539
}
4640
}
47-
}
41+
}

docs/README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
This is the documentation for Rollup Plugin Vue v4 and above. If you are upgrading from v2 or an earlier version, check out the [Migration Guide](./migrating.md). If you are using an older version, the old docs are [here](https://github.com/vuejs/rollup-plugin-vue/tree/2.2/docs).
55
:::
66

7-
## What is Rollup Plugin Vue?
7+
## What does Rollup Plugin Vue do?
88

9-
`rollup-plugin-vue` is a plugin for [rollup](https://rollupjs.org/) that allows you to author Vue components in a format called [Single-File Components (SFCs)](https://vue-loader.vuejs.org/spec.html):
9+
This is a plugin for [rollup](https://rollupjs.org/) that allows you to author Vue components in a format called [Single-File Components (SFCs)](https://vue-loader.vuejs.org/spec.html). They look like this:
1010

1111
``` vue
1212
<template>
13-
<div class="example">{{ msg }}</div>
13+
<div class="example">{{ message }}</div>
1414
</template>
1515
1616
<script>
1717
export default {
1818
data () {
1919
return {
20-
msg: 'Hello world!'
20+
message: 'Hello world!'
2121
}
2222
}
2323
}
@@ -30,11 +30,14 @@ export default {
3030
</style>
3131
```
3232

33-
There are many cool features provided by `rollup-plugin-vue`:
33+
This plugin also enables:
3434

35-
- Feature parity with [vue-loader](https://vue-loader.vuejs.org)
36-
- Allows custom blocks in a `.vue` file;
37-
- Treat static assets referenced in `<style>` and `<template>` as module dependencies;
38-
- Simulate scoped CSS for each component.
35+
- scoped CSS
36+
- custom blocks
37+
- static assets references within `<style>` and `<template>`
3938

40-
Rollup is a module bundler which makes `rollup-plugin-vue` ideal for packaging Vue plugins and UI component libraries.
39+
And many other other features, maintaining parity with [Vue Loader](https://vue-loader.vuejs.org).
40+
41+
## Why should I use Rollup over Webpack?
42+
43+
Rollup offers optimizations like tree shaking that make it ideal for building shared libraries. This plugin also prioritizes defaults that are ideal for most Vue plugins and UI component libraries.

docs/cookbook/README.md renamed to docs/examples.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Cookbook
1+
# Examples
22

3-
The Cookbook gives developers examples to work off of that both cover common or interesting use cases, and also progressively explain more complex detail. Our goal is to move beyond a simple introductory example, and demonstrate concepts that are more widely applicable, as well as some caveats to the approach.
3+
These examples cover most common or interesting use cases, and also progressively explain more complex detail. Our goal is to move beyond a simple introductory example, and demonstrate concepts that are more widely applicable, as well as some caveats to the approach.
44

55
## Minimal
66

@@ -26,7 +26,7 @@ Source: [cookbook/typescript-simple](https://github.com/vuejs/rollup-plugin-vue/
2626

2727
## SSR
2828

29-
<<< @/cookbook/ssr/rollup.config.js{2,12-16}
29+
<<< @/cookbook/ssr/rollup.config.js{10}
3030

3131
Source: [cookbook/ssr](https://github.com/vuejs/rollup-plugin-vue/tree/master/cookbook/ssr)
3232

docs/getting-started.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Getting Started
2+
3+
Add `rollup-plugin-vue` to the `plugins` array in `rollup.config.js`:
4+
5+
``` js
6+
import vue from 'rollup-plugin-vue'
7+
8+
export default {
9+
// ...
10+
plugins: [
11+
// ...
12+
vue(/* options */)
13+
]
14+
}
15+
```
16+
17+
That's all you need! You can customize this plugin's behavior by passing it an optional [options object](/options.html).

docs/guide/README.md

-18
This file was deleted.

docs/options.md

+31-30
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
---
2-
sidebar: auto
2+
sidebarDepth: 2
33
---
4-
# Options Reference
54

6-
## include
5+
# Options
6+
7+
## `include`
78

89
- type: `Array<string|RegExp> | string | RegExp`
910
- default: `[/\.vue$/i]`
1011

11-
## exclude
12+
## `exclude`
1213

1314
- type: `Array<string|RegExp> | string | RegExp`
1415
- default: `[]`
1516

1617
A minimatch pattern or a regular expression or an array of minimatch patterns or regular expressions.
1718

18-
## defaultLang
19+
## `defaultLang`
1920

2021
- type: `{ [key: string]: string }`
2122
- default: `{}`
@@ -28,96 +29,96 @@ e.g.: `defaultLang: { script: 'ts' }` would set default `<script>` block languag
2829
`defaultLang` does not set default language in templates for your editor/IDE.
2930
:::
3031

31-
## blackListCustomBlocks
32+
## `blackListCustomBlocks`
3233

3334
- type: `string[]`
3435
- default: `['*']`
3536

3637
Exclude custom block from final bundle.
3738

38-
## whiteListCustomBlocks
39+
## `whiteListCustomBlocks`
3940

4041
- type: `string[]`
4142
- default: `[]`
4243

4344
Include custom block in final bundle.
4445

45-
## css
46+
## `css`
4647

4748
- type: `boolean`
4849
- default: `true`
4950

5051
Inject CSS in JavaScript. Setting `css: false` would extract styles in a `.css` file.
5152

52-
## compiler
53+
## `compiler`
5354

5455
- type: [VueTemplateCompiler](https://github.com/vuejs/component-compiler-utils#parseparseoptions-sfcdescriptor)
5556
- default: `require('vue-template-compiler')`
5657

5758
Override template parser.
5859

59-
## compilerParseOptions
60+
## `compilerParseOptions`
6061

6162
- type: [VueTemplateCompilerParseOptions](https://github.com/vuejs/component-compiler-utils#parseparseoptions-sfcdescriptor)
6263
- default: `undefined`
6364

64-
## sourceRoot
65+
## `sourceRoot`
6566

6667
- type: string
6768
- default: `process.cwd()`
6869

69-
## style
70+
## `style`
7071

7172
`@vue/component-compiler` options to process `<style>` blocks in SFCs.
7273

73-
### style.postcssOptions
74+
### `style.postcssOptions`
7475

7576
- type: `any`
7677
- default: `undefined`
7778

78-
### style.postcssPlugins
79+
### `style.postcssPlugins`
7980

8081
- type: `any[]`
8182
- default: `undefined`
8283

83-
### style.postcssCleanOptions
84+
### `style.postcssCleanOptions`
8485

8586
- type: `object`
8687
- default: `{}`
8788

88-
### style.postcssModulesOptions
89+
### `style.postcssModulesOptions`
8990

9091
- type: `object`
9192
- default:
9293

9394
``` js
94-
{
95-
generateScopedName: '[path][local]-[hash:base64:4]'
95+
{
96+
generateScopedName: '[path][local]-[hash:base64:4]'
9697
}
9798
```
9899

99-
### style.preprocessOptions
100+
### `style.preprocessOptions`
100101

101102
- type: `{ [lang: string]: object }`
102103
- default: `{}`
103104

104-
### style.trim
105+
### `style.trim`
105106

106107
- type: `boolean`
107108
- default: `true`
108109

109-
## template
110+
## `template`
110111

111112
`@vue/component-compiler` options to process `<template>` blocks in SFCs.
112113

113-
### template.compiler
114+
### `template.compiler`
114115

115116
- type: `VueTemplateCompiler`
116117
- default: `require('vue-template-compiler')`
117118

118119
Override the default compiler used to compile `<template>` blocks in single file components.
119120

120-
### template.compilerOptions
121+
### `template.compilerOptions`
121122

122123
- type: `Object`
123124
- default: `{}`
@@ -126,7 +127,7 @@ Options for the template compiler. When using the default vue-template-compiler,
126127

127128
See [`vue-template-compiler` options reference](https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#options).
128129

129-
### template.transformAssetUrls
130+
### `template.transformAssetUrls`
130131

131132
- type: `{ [tag: string]: string | Array<string> }`
132133
- default:
@@ -142,21 +143,21 @@ See [`vue-template-compiler` options reference](https://github.com/vuejs/vue/tre
142143

143144
During template compilation, the compiler can transform certain attributes, such as `src` URLs, into `require` calls, so that the target asset can be handled by webpack. For example, `<img src="./foo.png">` will attempt to locate the file `./foo.png` on your file system and include it as a dependency of your bundle.
144145

145-
### template.isProduction
146+
### `template.isProduction`
146147

147148
- type: `boolean`
148149
- default: `process.env.NODE_ENV === 'production' || process.env.BUILD === 'production'`
149150

150151
Force production mode, which prohibits the plugin from emitting code that is development-only.
151152

152-
### template.optimizeSSR
153+
### `template.optimizeSSR`
153154

154155
- type: `boolean`
155156
- default: `process.env.VUE_ENV === 'server'`
156157

157158
Enable Vue 2.4 SSR compilation optimization that compiles part of the vdom trees returned by render functions into plain strings, which improves SSR performance. In some cases you might want to explicitly turn it off because the resulting render functions can only be used for SSR and cannot be used for client-side rendering or testing.
158159

159-
### template.transpileOptions
160+
### `template.transpileOptions`
160161

161162
- type: `Object`
162163
- default: `{}`
@@ -165,17 +166,17 @@ Configure ES2015+ to ES5 transpiling options for the generated render function c
165166

166167
The template render functions compilation supports a special transform `stripWith` (enabled by default), which removes the `with` usage in generated render functions to make them strict-mode compliant.
167168

168-
## normalizer
169+
## `normalizer`
169170

170171
- type: `string`
171172
- default: `undefined`
172173

173-
## styleInjector
174+
## `styleInjector`
174175

175176
- type: `string`
176177
- default: `undefined`
177178

178-
## styleInjectorSSR
179+
## `styleInjectorSSR`
179180

180181
- type: `string`
181182
- default: `undefined`

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
"typescript": "^2.8.3",
8686
"vue": "^2.5.16",
8787
"vue-class-component": "^6.2.0",
88-
"vue-template-compiler": "^2.5.16"
88+
"vue-template-compiler": "^2.5.16",
89+
"vuepress": "^0.13.0"
8990
},
9091
"peerDependencies": {
9192
"vue-template-compiler": "*"

0 commit comments

Comments
 (0)