PurgeCSS 与 React-bootstrap 可能吗?

Geo*_*lev 7 twitter-bootstrap react-bootstrap gatsby css-purge

我有一个带有 react-bootstrap、bootstrap 和 scss 设置的 gatsby 站点,我正在尝试清除未使用的 css。为此,我需要使用 purgeCss,但它在需要时不起作用。它似乎无法捕获我在页面中使用的 react-bootstrap 组件中的类。我阅读了文档,尝试了一些修复,但没有任何效果。有人能帮我吗 ?

bor*_*Blu 5

要设置PurgeCSS为允许react-bootstrap我使用过的类:

purgeCss: {
    whitelist: () => ['html', 'body', 'collapse', 'collapsing'],
    whitelistPatterns: () => [/modal*/, /accordion*/, /card*/],
    whitelistPatternsChildren: () => [/modal*/, /accordion*/, /card*/]
},
Run Code Online (Sandbox Code Playgroud)