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
@@ -133,19 +133,35 @@ You can also include Webpack loader queries in the `lang` attribute:
133
133
</style>
134
134
```
135
135
136
-
## Autoprefixing
136
+
## PostCSS
137
137
138
-
Starting in 6.0.0, Any CSS output via `vue-loader` is piped through [autoprefixer](https://github.com/postcss/autoprefixer)by default. You can customize this behavior in the `vue` section of your webpack config:
138
+
Any CSS output via `vue-loader`6.0+ is piped through [PostCSS](https://github.com/postcss/postcss) for [scoped CSS](#scoped-css) rewriting and aut-prefixed by default using [autoprefixer](https://github.com/postcss/autoprefixer). You can configure autoprefixer or provide your own PostCSS plugins in the `vue` section of your webpack config:
139
139
140
140
```js
141
141
// webpack.config.js
142
142
module.exports= {
143
143
// other configs...
144
144
vue: {
145
-
// disable autoprefixing
146
-
autoprefixer:false,
147
-
// OR: custom options
148
-
autoprefixer: { browsers: ['last 2 versions'] }
145
+
// configure autoprefixer
146
+
autoprefixer: {
147
+
browsers: ['last 2 versions']
148
+
}
149
+
}
150
+
}
151
+
```
152
+
153
+
Using other PostCSS plugins:
154
+
155
+
```js
156
+
// webpack.config.js
157
+
module.exports= {
158
+
// other configs...
159
+
vue: {
160
+
// use custom postcss plugins
161
+
postcss: [require('cssnext')()],
162
+
// disable vue-loader autoprefixing.
163
+
// this is a good idea since cssnext comes with it too.
164
+
autoprefixer:false
149
165
}
150
166
}
151
167
```
@@ -180,7 +196,7 @@ For more details, see the respective documentations for [vue-html-loader](https:
180
196
181
197
> Experimental
182
198
183
-
When a `<style>` tag has the `scoped` attribute, its CSS will apply to elements of the current component only. This is similar to the style encapsulation found in Shadow DOM, but doesn't require any polyfills. It is achieved by transforming the following:
199
+
When a `<style>` tag has the `scoped` attribute, its CSS will apply to elements of the current component only. This is similar to the style encapsulation found in Shadow DOM, but doesn't require any polyfills. It is achieved by using PostCSS to transform the following:
184
200
185
201
```html
186
202
<stylescoped>
@@ -197,12 +213,12 @@ Into the following:
197
213
198
214
```html
199
215
<style>
200
-
.example[_v-1] {
216
+
.example[_v-f3f3eg9] {
201
217
color: red;
202
218
}
203
219
</style>
204
220
<template>
205
-
<divclass="example"_v-1>hi</div>
221
+
<divclass="example"_v-f3f3eg9>hi</div>
206
222
</template>
207
223
```
208
224
@@ -212,7 +228,9 @@ Into the following:
212
228
213
229
2. A child component's root node will be affected by both the parent's scoped CSS and the child's scoped CSS.
214
230
215
-
3. Partials are not affected by scoped styles.
231
+
3. If you are nesting a component inside itself, the styles may still leak down since they are considered the same component.
0 commit comments