codyhouse / codyhouse-framework

A lightweight front-end framework for building accessible, bespoke interfaces.
https://codyhouse.co/
MIT License
1.16k stars 173 forks source link

PurgeCSS ignores breakpoint classes #80

Closed retroriff closed 3 years ago

retroriff commented 3 years ago

I have added PurgeCSS into my Grunt tasks and it works but it exclude classes with breakpoints such as "display@md". I have tried to whitelist them but it didn't work. These are the options that I tried:

whitelist: ['display@sm', 'display\\@sm']
whitelistPatterns: [/^display/]

All CodyHouse classes that contain special characters are ignored by PurgeCSS, like "width-100%" or "height-100%".

claudia-romano commented 3 years ago

Hi, you should use the defaultExtractor option. Something like:

defaultExtractor: content => content.match(/[\w-/:%@]+(?<!:)/g) || []
retroriff commented 3 years ago

@claudia-romano It worked like a charm, thank you!