From 8cd20767587260f2265f01072302dc867be01b33 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Thu, 11 Apr 2019 09:57:52 +0530 Subject: [PATCH] fix(#84): Move postcss-modules plugins to last --- src/compiler.ts | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 42ed177..a8bbc29 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -229,22 +229,24 @@ export class SFCCompiler { style.module === true || typeof style.module === 'string' const needsCleanCSS = this.template.isProduction && !(this.style.postcssCleanOptions && this.style.postcssCleanOptions.disabled) - const postcssPlugins = [ - needsCSSModules - ? postcssModules({ - generateScopedName: '[path][local]-[hash:base64:4]', - ...this.style.postcssModulesOptions, - getJSON: (t: any) => { - tokens = t - } - }) - : undefined, - needsCleanCSS - ? postcssClean(this.style.postcssCleanOptions) - : undefined - ] - .concat(this.style.postcssPlugins) + const postcssPlugins = (this.style.postcssPlugins || []) + .slice() + .concat([ + needsCleanCSS + ? postcssClean(this.style.postcssCleanOptions) + : undefined, + needsCSSModules + ? postcssModules({ + generateScopedName: '[path][local]-[hash:base64:4]', + ...this.style.postcssModulesOptions, + getJSON: (t: any) => { + tokens = t + } + }) + : undefined, + ]) .filter(Boolean) + const preprocessOptions = (style.lang && this.style.preprocessOptions &&