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

Commit 7a5cc05

Browse files
committed
Complete 2.3 docs
1 parent 04722c1 commit 7a5cc05

File tree

13 files changed

+156
-88
lines changed

13 files changed

+156
-88
lines changed

.github/sereno/content/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.
-5.39 MB
Binary file not shown.
-2.45 MB
Binary file not shown.
-9.73 KB
Binary file not shown.

.github/sereno/resources/views/base.blade.php

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/sereno/resources/views/nav.blade.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/CHANGELOG.md renamed to CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
All Notable changes to `rollup-plugin-vue` will be documented in this file.
44

5+
## [Unreleased]
6+
57
## [Version 2.2.15][2.2.15] - 2017-01-10
68

79
### Added
@@ -15,6 +17,7 @@ All Notable changes to `rollup-plugin-vue` will be documented in this file.
1517
### Added
1618
- Compile *.vue files.
1719

20+
[Unreleased]: https://github.com/znck/rollup-plugin-vue/compare/v2.0.0...HEAD
1821
[2.0.0]: https://github.com/znck/rollup-plugin-vue/compare/v1.0.3...v2.0.0
1922
[2.2.15]: https://github.com/znck/rollup-plugin-vue/compare/v2.2.14...v2.2.15
2023

File renamed without changes.

docs/en/2.3/README.md

Lines changed: 112 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ nav: en2.3
66
## Installation
77
[Node][node] and [Rollup][rollup] are required to use rollup-plugin-vue. Use [NPM][NPM] or [yarn][yarn] to add `rollup-plugin-vue` as development dependency to your project.
88

9-
### Using NPM
9+
##### Using NPM
1010
```
1111
npm install --save-dev rollup-plugin-vue
1212
```
1313

14-
### Using yarn
14+
##### Using yarn
1515
```
1616
yarn add --dev rollup-plugin-vue
1717
```
1818

19-
### Use plugin
19+
##### Use plugin
2020
Next add `rollup-plugin-vue` to `rollup` plugins.
2121

2222
``` js
@@ -25,7 +25,7 @@ import vue from 'rollup-plugin-vue';
2525

2626
export default {
2727
plugins: [
28-
vue(),
28+
vue({ /* configuration options. */ }),
2929
],
3030
};
3131
```
@@ -84,10 +84,16 @@ List of supported style languages:
8484
The default style language.
8585

8686
- ##### Sass/Scss
87-
It uses `node-sass@^4.5.0` to process `sass/scss` style elements. You can provide `node-sass` configuration options by ```scss: { /* node-sass options */}```.
87+
It uses `node-sass@^4.5.0` to process `sass/scss` style elements. You can provide `node-sass` configuration options by setting:
88+
``` js
89+
scss: { /* node-sass options */}
90+
```
8891

8992
- ##### Less
90-
It uses `less@^2.7.2` to process `less` style elements. You can provide `less` configuration options by ```less: { /* node-sass options */}```.
93+
It uses `less@^2.7.2` to process `less` style elements. You can provide `less` configuration options by setting:
94+
``` js
95+
less: { /* node-sass options */}
96+
```
9197

9298
<p class="tip" markdown="1">
9399
`node-sass` and `less` are optional dependencies. If you are using `scss/sass/less` you should require (`yarn add --dev node-sass less`) them.
@@ -112,29 +118,124 @@ export default {
112118
```
113119

114120
#### CSS Modules
121+
[CSS Modules](https://github.com/css-modules/css-modules) is a popular system for modularizing and composing CSS. `rollup-plugin-vue` provides first-class integration with CSS Modules as an alternative for simulated scoped CSS.
122+
123+
``` vue
124+
<style module>
125+
.red {
126+
color: red;
127+
}
128+
129+
.bold {
130+
font-weight: bold;
131+
}
132+
</style>
133+
134+
<template>
135+
<div>
136+
<p :class="{ [$style.red]: isRed }">
137+
Am I red?
138+
</p>
139+
140+
<p :class="[$style.red, $style.bold]">
141+
Red and bold
142+
</p>
143+
</div>
144+
</template>
145+
146+
<script>
147+
export default {
148+
computed: {
149+
150+
$style () {
151+
return this.$options.cssModules
152+
}
153+
154+
}
155+
}
156+
</script>
157+
```
158+
159+
<p class="tip">
160+
`rollup-plugin-vue@^2.3` cannot add `$style` computed property. You have to explcitly add it.
161+
</p>
162+
163+
``` js
164+
$style () {
165+
return this.$options.cssModules
166+
}
167+
```
168+
169+
##### Custom Inject Name
170+
You can have more than one `<style>` tags in a single *.vue component. To avoid injected styles to overwrite each other, you can customize the name of the injected computed property by giving the module attribute a value:
115171

172+
```
173+
<style module="a">
174+
/* identifiers injected as a */
175+
</style>
176+
177+
<style module="b">
178+
/* identifiers injected as b */
179+
</style>
180+
```
181+
##### CSS Modules Configuration
182+
`rollup-plugin-vue` uses `postcss-modules` to handle CSS modules.
183+
184+
You can provide `postcss-modules` configuration options by setting:
185+
``` js
186+
cssModules: { generateScopedName: '[name]__[local]', ... }
187+
```
116188

117189
### Template
190+
Templates are processed into `render` function by default. You can disable this by setting:
191+
``` js
192+
compileTemplate: false
193+
```
194+
195+
#### Static Class Replacement
196+
When using CSS modules, class names are replaced in template at compile time.
197+
198+
For example:
199+
```
200+
<div class="red">Foo</div>
201+
```
202+
would become
203+
```
204+
<div class="_lkcjalei8942jksa_0">Foo</div>
205+
```
206+
before compiling to `render` function. This saves you from binding `class` attribute to `$style.red`.
207+
208+
You can disable this behavior by setting:
209+
``` js
210+
disableCssModuleStaticReplacement: true
211+
```
118212

119213
#### Template Languages
120214

121215
- ##### HTML
216+
Default template language.
122217

123218
- ##### Pug/Jade
219+
It uses `pug@^2.0.0-beta11` to process `pug` template elements. You can provide `pug` configuration options by setting:
220+
``` js
221+
pug: { /* pug options */}
222+
```
124223

125224
### Script
126225

127226
#### Script Languages
128-
129-
- ##### ES6/Babel
227+
ES6 is catching up but `coffee` script is still popular with some developers.
130228

131229
- ##### Coffee
132-
133-
### Custom template injection
230+
It uses `coffeescript-compiler@^0.1.1` to process `coffee` script elements. You can use `lang="coffee"` or `lang="coffeescript"`.
134231

135232
### Handle with(this) issue
233+
Vue uses `with(this)` in render function as scoping rules of `with` aligns with scoping rules of templates. Using `with` in strict mode is forbidden.
136234

137-
### include/exclude
235+
`rollup-plugin-vue` strips away all `with(this)` statements by default. You can disable this by setting:
236+
``` js
237+
vue: { transforms: { stripWith: false } }
238+
```
138239
139240
[node]: http://nodejs.org/
140241
[rollup]: http://rollupjs.org

0 commit comments

Comments
 (0)