diff --git a/lib/style-rewriter.js b/lib/style-rewriter.js index a212d0a..3639240 100644 --- a/lib/style-rewriter.js +++ b/lib/style-rewriter.js @@ -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) @@ -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, @@ -77,3 +84,4 @@ module.exports = function (id, css, scoped) { }) } } +