Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

fix(#84): Move postcss-modules plugins to last #86

Merged
merged 1 commit into from
Apr 11, 2019
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
32 changes: 17 additions & 15 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down