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

Commit 2f63b25

Browse files
Darius Tallyyx990803
authored andcommitted
Add the ability to specify other postcss options (#99)
* Add the ability to specify other postcss options * Fixed usage of postcss
1 parent bce369d commit 2f63b25

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/style-rewriter.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,16 @@ module.exports = function (id, css, scoped) {
4545
if (val) {
4646
return Promise.resolve(val)
4747
} else {
48-
var plugins = options.postcss
49-
? options.postcss.slice()
50-
: []
48+
var plugins = []
49+
var opts = {}
50+
51+
if (options.postcss instanceof Array) {
52+
plugins = options.postcss.slice()
53+
} else if (options.postcss instanceof Object) {
54+
plugins = options.postcss.plugins || []
55+
opts = options.postcss.options
56+
}
57+
5158
// scoped css rewrite
5259
if (scoped) {
5360
plugins.push(addId)
@@ -66,7 +73,7 @@ module.exports = function (id, css, scoped) {
6673
}
6774
currentId = id
6875
return postcss(plugins)
69-
.process(css)
76+
.process(css, opts)
7077
.then(function (res) {
7178
var val = {
7279
source: res.css,
@@ -77,3 +84,4 @@ module.exports = function (id, css, scoped) {
7784
})
7885
}
7986
}
87+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy