Skip to content

Commit 1b3d509

Browse files
committed
docs: update nextjs guide
add safelist #594
1 parent 2b86f2d commit 1b3d509

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/guides/next.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ To customize the PostCSS configuration, create a postcss.config.js file in the r
3434

3535
> Warning: When you define a custom PostCSS configuration file, Next.js completely disables the default behavior. Be sure to manually configure all the features you need compiled, including [Autoprefixer](https://github.com/postcss/autoprefixer). You also need to install any plugins included in your custom configuration manually, i.e. `npm install postcss-flexbugs-fixes postcss-preset-env`.
3636
37+
> By default, the outer document containing `html` and `body` is inside nextjs node module. Add `safelist:["html", "body"]` to make sure PurgeCSS does not remove those style.
38+
3739
Add PurgeCSS to the default configuration:
3840

3941
```js
@@ -59,7 +61,8 @@ module.exports = {
5961
'./pages/**/*.{js,jsx,ts,tsx}',
6062
'./components/**/*.{js,jsx,ts,tsx}'
6163
],
62-
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || []
64+
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
65+
safelist: ["html", "body"]
6366
}
6467
],
6568
]

0 commit comments

Comments
 (0)