From faaeee416f3750381cc58f6e7df2b359d7bd872e Mon Sep 17 00:00:00 2001 From: Michael Ciniawsky Date: Wed, 10 May 2017 10:26:13 +0200 Subject: [PATCH] fix(index): `postcss.config.js` not resolved correctly (`options.config`) --- lib/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index df22b8c4..a90b3074 100644 --- a/lib/index.js +++ b/lib/index.js @@ -48,24 +48,25 @@ module.exports = function loader (css, map) { validateOptions(require('./options.json'), options, 'PostCSS Loader') const rc = { - path: '', + path: path.dirname(file), ctx: { file: { extname: path.extname(file), dirname: path.dirname(file), basename: path.basename(file) - } + }, + options: {} } } if (options.config) { - options.config.path - ? rc.path = path.resolve(options.config.path) - : rc.path = path.dirname(file) + if (options.config.path) { + rc.path = path.resolve(options.config.path) + } - options.config.ctx - ? rc.ctx.options = options.config.ctx - : rc.ctx.options = {} + if (options.config.ctx) { + rc.ctx.options = options.config.ctx + } } const sourceMap = options.sourceMap