You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 18, 2022. It is now read-only.
There are many cool features provided by `rollup-plugin-vue`:
46
+
- ES2015 enabled by default;
47
+
- Builtin support for sass, less and stylus for `<style>`;
48
+
- Builtin support for pug for `<template>`
49
+
50
+
In a nutshell, the combination of Rollup and rollup-plugin-vue gives you a modern, flexible and extremely powerful workflow authoring Vue.js components & plugins.
51
+
52
+
<pclass="tip">
53
+
This plugin is best for authoring component modules and plugins. Use webpack and [vue-loader](http://vue-loader.vuejs.org) for authoring Vue.js applications.
Copy file name to clipboardExpand all lines: docs/en/2.2/README.md
+54-31Lines changed: 54 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,51 @@
1
-
# Configuration
1
+
---
2
+
nav: en2.2
3
+
4
+
---
5
+
6
+
## Installation
7
+
[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.
8
+
9
+
### Using NPM
10
+
```
11
+
npm install --save-dev rollup-plugin-vue
12
+
```
13
+
14
+
### Using yarn
15
+
```
16
+
yarn add --dev rollup-plugin-vue
17
+
```
18
+
19
+
### Use plugin
20
+
Next add `rollup-plugin-vue` to `rollup` plugins.
21
+
22
+
```js
23
+
// rollup.config.js
24
+
importvuefrom'rollup-plugin-vue';
25
+
26
+
exportdefault {
27
+
plugins: [
28
+
vue(),
29
+
],
30
+
};
31
+
```
32
+
## Configuration
2
33
For most cases `rollup-plugin-vue` works out of the box. But, you can always configure it to your needs.
3
34
4
35
Following configuration are available to be overridden.
It accepts a filename, `false`, `null` or a `Function`.
21
51
@@ -103,8 +133,7 @@ It accepts a filename, `false`, `null` or a `Function`.
103
133
};
104
134
```
105
135
106
-
{#compileTemplate}
107
-
### The `compileTemplate` option
136
+
### `compileTemplate` option
108
137
109
138
With Vue 2.0, you can have [two builds](https://vuejs.org/v2/guide/installation.html#Standalone-vs-Runtime-only-Build); Runtime-only and Standalone.
110
139
Runtime-only build does not include template compiler. So, it is required compile `template` string to `render`function.
@@ -116,8 +145,7 @@ This option takes `boolean` value.
116
145
117
146
**NOTE:** If `compileTemplate` is not set and Vue 2.0 is in project dependencies, then it would compile to `template` to `render` function.
118
147
119
-
{#styleToImports}
120
-
### The `styleToImports` option
148
+
### `styleToImports` option
121
149
Other than `css` option, the plugin allows you to convert your styles to javascript imports.
122
150
123
151
Following script defers styles handling.
@@ -135,20 +163,16 @@ export default {
135
163
};
136
164
```
137
165
138
-
{#stripWith}
139
-
### The `stripWith` option
166
+
### `stripWith` option
140
167
For Vue 2.0 builds, `with(this)` is stripped off by default. You can disable this by setting `{ stripWith:false }`.
141
168
142
-
{#include}
143
-
### The `include` option
169
+
### `include` option
144
170
A minimatch pattern or an array of minimatch patterns as required for [Rollup](https://github.com/rollup/rollup/wiki/Plugins#creating-plugins) transformer plugins.
145
171
146
-
{#exclude}
147
-
### The `exclude` option
172
+
### `exclude` option
148
173
A minimatch pattern or an array of minimatch patterns as required for [Rollup](https://github.com/rollup/rollup/wiki/Plugins#creating-plugins) transformer plugins.
149
174
150
-
{#htmlMinifier}
151
-
### The `htmlMinifier` option
175
+
### `htmlMinifier` option
152
176
The template string is minified using [htmlMinifier](https://github.com/kangax/html-minifier). The default configuration used with htmlMinifier is as follows:
153
177
154
178
``` js
@@ -177,19 +201,18 @@ export default {
177
201
};
178
202
```
179
203
180
-
{#inject}
181
-
### The `inject` option
204
+
### `inject` option
182
205
A custom `inject` function to add `template` or `render` function to component. It would receive 3 parameters:
183
206
- script (String) -- Contents of script tag.
184
207
- template/render (String) -- Processed template or compiled render function.
185
208
- lang (String) -- Language of script. (Inferred from `lang` attribute on `<script>` tag.)
186
209
187
210
The `inject` function should return processed script string.
188
211
189
-
For reference, checkout [inject function](https://github.com/znck/rollup-plugin-vue/blob/master/src/vueTransform.js#L43-L61) for `lang=js` or `lang=babel`.
212
+
For reference, checkout [inject function](https://github.com/znck/rollup-plugin-vue/blob/2.2/src/vueTransform.js#L43-L61) for `lang=js` or `lang=babel`.
190
213
191
-
<br><br><br>
192
214
193
-
-------------------------------
194
-
[Edit this page on Github]({{ $docs_edit_url }}/configuration.md)
0 commit comments