Skip to content

Commit

Permalink
Update postcss.config.js (#11366)
Browse files Browse the repository at this point in the history
* Update postcss.config.js

Return empty array if the condition is not met to avoid a null/undefined PostCSS plugin.

* Update postcss.config.js

Fix array spread

* Update postcss.config.js

remove extra operator

* Fix linting

Co-authored-by: Tim Neutkens <[email protected]>
  • Loading branch information
paul-vd and timneutkens authored Apr 6, 2020
1 parent 20f2b0b commit 19f41c6
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions examples/with-tailwindcss/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
module.exports = {
plugins: [
'tailwindcss',
process.env.NODE_ENV === 'production'
...(process.env.NODE_ENV === 'production'
? [
'@fullhuman/postcss-purgecss',
{
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
},
[
'@fullhuman/postcss-purgecss',
{
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
defaultExtractor: content =>
content.match(/[\w-/:]+(?<!:)/g) || [],
},
],
]
: undefined,
: []),
'postcss-preset-env',
],
}

0 comments on commit 19f41c6

Please sign in to comment.