Skip to content

Commit

Permalink
fix postcss.config.js warnings (#12070)
Browse files Browse the repository at this point in the history
* update postcss.config.js to fix warnings

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

Related PR: #11366

* style: correct linting error
  • Loading branch information
oddnavy authored Apr 21, 2020
1 parent 918cf38 commit 600b78c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions examples/blog-starter/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 600b78c

Please sign in to comment.