PurgeCSSPurgeCSS
API Reference
  • English
  • Français
GitHub
API Reference
  • English
  • Français
GitHub
  • PurgeCSS

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

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

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

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

Home > @fullhuman/postcss-purgecss > UserDefinedOptions

UserDefinedOptions interface

Options used by PurgeCSS to remove unused CSS

Signature:

export interface UserDefinedOptions extends Omit<PurgeCSSUserDefinedOptions, "content" | "css"> 

Extends: Omit<PurgeCSSUserDefinedOptions, "content" | "css">

Properties

Property

Modifiers

Type

Description

content?

PurgeCSSUserDefinedOptions["content"]

(Optional)

contentCache?

boolean

(Optional) Keep the selectors extracted from the content files between the CSS files and the runs of the plugin in the process: a content file is only read and extracted again when it changed. Set it to false to read and extract the content files for every CSS file.

contentFunction?

(sourceFile: string) => Array<string | RawContent>

(Optional)

dependencies?

boolean | DependenciesOptions

(Optional) Add PostCSS dependency messages for the content files and globs, so that the dev servers (Vite, webpack and Rspack with postcss-loader, Next.js, Parcel) run the plugin again when the content changes. Set it to false to add no message, e.g. when a bundler rejects a path of the content.

Pass an object to set the root directory of the bundler: the paths outside it get no message. Under Turbopack (Next.js), which stops with an error for a path outside its root, the root defaults to the one Next.js infers (the outermost directory with a workspace marker or a lock file). Set it to the value of outputFileTracingRoot or turbopack.root when the Next.js config sets one of them.