Skip to content

Commit

Permalink
feat: add support for deprecated build.postcss.plugins array syntax (#36
Browse files Browse the repository at this point in the history
)
  • Loading branch information
andrewvasilchuk authored and atinux committed Nov 5, 2019
1 parent 004fc2d commit 6c3f550
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ module.exports = async function (moduleOptions) {
/*
** Set PostCSS config (before nuxt-purgecss)
*/
this.options.build.postcss.preset.stage = 1 // see https://tailwindcss.com/docs/using-with-preprocessors#future-css-features
this.options.build.postcss.plugins = this.options.build.postcss.plugins || {}
this.options.build.postcss.plugins.tailwindcss = this.options.build.postcss.plugins.tailwindcss || configPath
const { postcss } = this.options.build

postcss.preset.stage = 1 // see https://tailwindcss.com/docs/using-with-preprocessors#future-css-features
postcss.plugins = postcss.plugins || {}

if (Array.isArray(postcss.plugins)) {
postcss.plugins.push(require('tailwindcss')(configPath))
} else if (typeof postcss.plugins === 'object') {
postcss.plugins.tailwindcss = postcss.plugins.tailwindcss || configPath
}

/*
** Add nuxt-purgecss module and set config
** only for `nuxt build` command
Expand Down

0 comments on commit 6c3f550

Please sign in to comment.