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

Add the ability to specify other postcss options #99

Merged
merged 2 commits into from
Jun 24, 2016
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) {
})
}
}

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