PurgeCSSPurgeCSS
API Reference
GitHub
API Reference
GitHub
  • PurgeCSS

    • About PurgeCSS
    • Getting Started
    • Configuration
    • Command Line Interface
    • Programmatic API
    • Safelisting
    • Extractors
  • Plugins

    • PostCSS
    • Webpack
    • Gulp
    • Grunt
    • Gatsby
  • Guides

    • Vue
    • React
    • Next.js
    • Nuxt.js
    • Razzle
    • WordPress
    • Hugo
  • Comparison
  • Common Questions

    • How to use with CSS modules
    • How to use with Ant Design

Home > purgecss > Options

Options interface

Options used by PurgeCSS to remove unused CSS Those options are used internally

Signature:

export interface Options 

Properties

Property

Modifiers

Type

Description

blocklist

StringRegExpArray

Blocklist will block the CSS selectors from appearing in the final output CSS. The selectors will be removed even when they are seen as used by PurgeCSS.

content

Array<string | RawContent>

You can specify content that should be analyzed by PurgeCSS with an array of filenames or globs. The files can be HTML, Pug, Blade, etc.

css

Array<string | RawCSS>

Similar to content, you can specify css that should be processed by PurgeCSS with an array of filenames or globs

defaultExtractor

ExtractorFunction

dynamicAttributes

string[]

Option to add custom CSS attribute selectors like "aria-selected", "data-selected", ...etc.

extractors

Array<Extractors>

fontFace

boolean

If there are any unused @font-face rules in your css, you can remove them by setting the fontFace option to true.

keyframes

boolean

output?

string

(Optional)

rejected

boolean

rejectedCss

boolean

safelist

Required<ComplexSafelist>

You can indicate which selectors are safe to leave in the final CSS. This can be accomplished with the option safelist.

skippedContentGlobs

Array<string>

If you provide globs for the content parameter, you can use this option to exclude certain files or folders that would otherwise be scanned. Pass an array of globs matching items that should be excluded. (Note: this option has no effect if content is not globs.)

sourceMap

boolean | (postcss.SourceMapOptions & { to?: string; })

stdin

boolean

stdout

boolean

variables

boolean

Edit this page