nuxt-purgecss icon indicating copy to clipboard operation
nuxt-purgecss copied to clipboard

Usage with CSS Modules

Open J05HI opened this issue 5 years ago • 1 comments

Hello @manniL how can we use PurgeCSS with CSS Modules? It doesn't remove unused classes. Thank you!

J05HI avatar May 25 '20 20:05 J05HI

this plugins purge well the css modules, but, the base config of purgecss does not remove unused keyframes/fonts and variables , if you add this to the nuxt config.

export default {
  ...
  purgeCSS: {
    keyframes: true,
    variables: true,
    fontFace: true,
  },
  ...
}

you have a global purge of all your style.

https://purgecss.com/configuration.html#options

with animate.css is work well when using only one animation , all unused class and keyframes is removed.

remigermain avatar Mar 07 '21 09:03 remigermain

Sadly, PurgecSS + CSS Modules is not as straightforward. I don't plan support for it in near future.

See https://github.com/FullHuman/purgecss/issues/163#issuecomment-526607181 for hints regarding a custom solution

TheAlexLichter avatar Sep 30 '22 11:09 TheAlexLichter