Trying new purge

This commit is contained in:
Belen Curcio
2020-10-26 10:26:04 -03:00
parent f3d506e271
commit 222c96472b
4 changed files with 42 additions and 6 deletions

View File

@@ -15,5 +15,23 @@ module.exports = {
},
},
],
[
'@fullhuman/postcss-purgecss',
{
content: ['./pages/**/*.{tsx}', './components/**/*.{tsx}'],
// This is the function used to extract class names from your templates
defaultExtractor: (content) => {
// Capture as liberally as possible, including things like `h-(screen-1.5)`
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
// Capture classes within other delimiters like .block(class="w-1/2") in Pug
const innerMatches =
content.match(/[^<>"'`\s.()]*[^<>"'`\s.():]/g) || []
return broadMatches.concat(innerMatches)
},
},
],
],
}