Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/style-rewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ module.exports = function (id, css, scoped) {
if (val) {
return Promise.resolve(val)
} else {
var plugins = options.postcss
? options.postcss.slice()
: []
var plugins = []
var opts = {}

if (options.postcss instanceof Array) {
plugins = options.postcss.slice()
} else if (options.postcss instanceof Object) {
plugins = options.postcss.plugins || []
opts = options.postcss.options
}

// scoped css rewrite
if (scoped) {
plugins.push(addId)
Expand All @@ -66,7 +73,7 @@ module.exports = function (id, css, scoped) {
}
currentId = id
return postcss(plugins)
.process(css)
.process(css, opts)
.then(function (res) {
var val = {
source: res.css,
Expand All @@ -77,3 +84,4 @@ module.exports = function (id, css, scoped) {
})
}
}