From 10a77fd5f9d2be55bd6b2cd8877cba363278a4a4 Mon Sep 17 00:00:00 2001 From: Terence Zhong <305740424@qq.com> Date: Tue, 22 Dec 2015 09:46:51 +0800 Subject: [PATCH 1/2] allow postcss options to be a function and close issue #106 --- lib/style-rewriter.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/style-rewriter.js b/lib/style-rewriter.js index 707d1d121..3896ee3cd 100644 --- a/lib/style-rewriter.js +++ b/lib/style-rewriter.js @@ -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) { From 6b3c0eeff073859ec99b0ece8f637e450ed9f8cc Mon Sep 17 00:00:00 2001 From: Terence Zhong <305740424@qq.com> Date: Tue, 22 Dec 2015 09:59:22 +0800 Subject: [PATCH 2/2] instead of null, expect error not exist in tests --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 68714e56c..8cb736ce5 100644 --- a/test/test.js +++ b/test/test.js @@ -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) }) }