purgecss icon indicating copy to clipboard operation
purgecss copied to clipboard

Documentation for purgecss-from-pug

Open titantwentyone opened this issue 5 years ago • 1 comments

Thanks for this plugin first of all. I have used purgecss to remove a lot of redundant css from Bootstrap and Fontawesome. My project is written with pug and saw that there is a repo for 'purgecss-from-pug' but the documentation is a little sparse. I am wondering if this module can squeeze down my css even further but unsure how to integrate this with my webpack setup (or indeed, if it is even necessary/possible). Currently "Coverage" in Chrome Dev Tools reports unsued bytes of 55% (down from 95%) but am hoping this can be reduced even further.

titantwentyone avatar Aug 02 '20 14:08 titantwentyone

There's only a limited documentation about extractors at the moment on this page: https://purgecss.com/extractors.html#using-an-extractor The idea is to use it like a custom extractor, purgecss-from-pug should be used like:

import purgePug from 'purgecss-from-pug'
const options = {
  content: [], // files to extract the selectors from
  css: [], // css
  extractors: [
    {
      extractor: purgePug,
      extensions: ['pug']
    },
  ]
}

Ffloriel avatar Aug 05 '20 21:08 Ffloriel