Skip to content

Latest commit

 

History

History
62 lines (53 loc) · 1.88 KB

getting-started.md

File metadata and controls

62 lines (53 loc) · 1.88 KB
title lang meta
Getting Started
en-US
name content
description
PurgeCSS is a tool to remove unused CSS from your project. It can be used as part of your development workflow. PurgeCSS comes with a JavaScript API, a CLI, and plugins for popular build tools.
itemprop content
description
PurgeCSS is a tool to remove unused CSS from your project. It can be used as part of your development workflow. PurgeCSS comes with a JavaScript API, a CLI, and plugins for popular build tools.
property content
og:url
property content
og:site_name
purgecss.com
property content
og:type
website
property content
og:image
property content
og:locale
en_US
property content
og:title
Remove unused CSS - PurgeCSS
property content
og:description
PurgeCSS is a tool to remove unused CSS from your project. It can be used as part of your development workflow. PurgeCSS comes with a JavaScript API, a CLI, and plugins for popular build tools.

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:

:::: code-group ::: code-group-item NPM

npm i -D @fullhuman/postcss-purgecss

::: ::: code-group-item YARN

yarn add @fullhuman/postcss-purgecss --dev

::: ::::

and add the PurgeCSS plugin to the PostCSS configuration:

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

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

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: