Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit baf10d5

Browse files
committed
5.0.4: expose postcss plugins
1 parent 92c8293 commit baf10d5

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ module.exports = {
135135
}
136136
```
137137

138-
## Autoprefix by Default
139-
140-
Starting in 5.0.0, all CSS output via vueify will be autoprefixed by default. See [config section](#configuring-options) on customizing the options.
141-
142138
## Enabling Pre-Processors
143139

144140
You need to install the corresponding node modules to enable the compilation. e.g. to get stylus compiled in your Vue components, do `npm install stylus --save-dev`.
@@ -152,6 +148,14 @@ These are the built-in preprocessors:
152148
- coffee-script
153149
- myth
154150

151+
## Autoprefix by Default
152+
153+
Starting in 5.0.0, all CSS output via vueify will be autoprefixed by default. See [config section](#configuring-options) below on customizing the options.
154+
155+
## PostCSS
156+
157+
Vueify uses PostCSS for scoped CSS rewrite and autoprefixing. You can also provide your own PostCSS plugins! See [config section](#configuring-options) below for an example.
158+
155159
## Configuring Options
156160

157161
Create a `vue.config.js` file at where your build command is run (usually the root level of your project):
@@ -162,6 +166,8 @@ module.exports = {
162166
sass: {
163167
includePaths: [...]
164168
},
169+
// provide your own postcss plugins
170+
postcss: [...],
165171
// configure autoprefixer
166172
autoprefixer: {
167173
browsers: ['last 2 versions']
@@ -177,6 +183,18 @@ module.exports = {
177183
}
178184
```
179185

186+
Example using custom PostCSS plugin:
187+
188+
``` js
189+
var cssnext = require('cssnext')
190+
191+
module.exports = {
192+
postcss: [cssnext()],
193+
// disable autoprefixer since cssnext comes with it
194+
autoprefixer: false
195+
}
196+
```
197+
180198
Alternatively, if you are using `vueify` in Node and don't want to create a `vue.config.js` file:
181199

182200
``` js
@@ -271,6 +289,10 @@ If you use Webpack, there's also [vue-loader](https://github.com/vuejs/vue-loade
271289

272290
## Changelog
273291

292+
### 5.0.4
293+
294+
- Added `postcss` option for providing custom PostCSS plugins.
295+
274296
### 5.0.0
275297

276298
- New: CSS output is now autoprefixed by default.

lib/style-rewriter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = function (id, css, scoped) {
4444
if (val) {
4545
return Promise.resolve(val)
4646
} else {
47-
var plugins = []
47+
var plugins = options.postcss || []
4848
// scoped css rewrite
4949
if (scoped) {
5050
plugins.push(addId)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vueify",
3-
"version": "5.0.3",
3+
"version": "5.0.4",
44
"description": "Vue component transform for Browserify",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)