Skip to content

Commit

Permalink
Support nuxt 2.16’s changes to postcss
Browse files Browse the repository at this point in the history
  • Loading branch information
weotch committed Feb 9, 2023
1 parent 49b1104 commit 847559e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/style.js
Expand Up @@ -34,9 +34,14 @@ export default function() {

// Disable cssnano's Calc transfrom, which beefs with fluid(). The `plugins`
// property wasn't set by default, which is why I'm using defaultsDeep here.
defaultsDeep(this.options.build.postcss, { plugins: {
cssnano: isDev ? false :
{ preset: [ 'default', { calc: false } ] }
}})
const postcssOptions = { plugins: {
cssnano: isDev ? false : { preset: [ 'default', { calc: false } ] }
}}
if (this.options.build.postcss.postcssOptions) { // Nuxt 2.16
defaultsDeep(this.options.build.postcss.postcssOptions, postcssOptions)
} else { // < Nuxt 2.16
defaultsDeep(this.options.build.postcss, postcssOptions)
}


}

0 comments on commit 847559e

Please sign in to comment.