Getting Started

Most bundlers and frameworks to build websites are using PostCSS. The easiest way to configure PurgeCSS is with its PostCSS plugin.

Install the PostCSS plugin:

npm i -D @fullhuman/postcss-purgecss
1
yarn add @fullhuman/postcss-purgecss --dev
1

and add the PurgeCSS plugin to the PostCSS configuration:

const purgecss = require('@fullhuman/postcss-purgecss')

module.exports = {
  plugins: [
    purgecss({
      content: ['./**/*.html']
    })
  ]
}
 



 
 
 


1
2
3
4
5
6
7
8
9

PurgeCSS will remove the CSS that is not in the files specified in the content option.

You can find more information about PostCSS plugin and the configuration options on the following pages: