Skip to content

Allow postcss options to be a function and close issue #106 #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 22, 2015
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions lib/style-rewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ module.exports = function (css, map) {
var query = loaderUtils.parseQuery(this.query)
var options = this.options.vue || {}
var autoprefixOptions = options.autoprefixer

// plugins
var plugins = options.postcss
? options.postcss.slice() // make sure to copy it
: []
if (typeof plugins === 'function') {
plugins = plugins.call(this, this)
}
plugins = plugins ? plugins.slice() : [] // make sure to copy it

// scoped css
if (query.scoped) {
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('vue-loader', function () {

function getFile (file, cb) {
fs.readFile(path.resolve(outputDir, file), 'utf-8', function (err, data) {
expect(err).to.be.null
expect(err).to.be.not.exist
cb(data)
})
}
Expand Down