Developmint / nuxt-purgecss

Drop superfluous CSS! A neat PurgeCSS wrapper for Nuxt.js
MIT License
478 stars 18 forks source link

Usage with CSS Modules #90

Closed J05HI closed 1 year ago

J05HI commented 4 years ago

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

remigermain commented 3 years ago

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.

manniL commented 1 year ago

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