purgecss

  • Version 4.0.3
  • Published
  • 46.6 kB
  • 4 dependencies
  • MIT license

Install

npm i purgecss
yarn add purgecss
pnpm add purgecss

Overview

Remove unused css selectors

Index

Variables

variable defaultOptions

const defaultOptions: Options;

    Functions

    function mergeExtractorSelectors

    mergeExtractorSelectors: (
    ...extractors: (ExtractorResultDetailed | ExtractorResultSets)[]
    ) => ExtractorResultSets;
    • Merge two extractor selectors

      Parameter extractorSelectorsA

      extractor selectors A

      Parameter extractorSelectorsB

      extractor selectors B

    function setOptions

    setOptions: (configFile?: string) => Promise<Options>;
    • Load the configuration file from the path

      Parameter configFile

      Path of the config file

    function standardizeSafelist

    standardizeSafelist: (
    userDefinedSafelist?: UserDefinedSafelist
    ) => Required<ComplexSafelist>;

      Classes

      class PurgeCSS

      class PurgeCSS {}

        property options

        options: Options;

          property selectorsRemoved

          selectorsRemoved: Set<string>;

            method extractSelectorsFromFiles

            extractSelectorsFromFiles: (
            files: string[],
            extractors: Extractors[]
            ) => Promise<ExtractorResultSets>;
            • Extract the selectors present in the files using a purgecss extractor

              Parameter files

              Array of files path or glob pattern

              Parameter extractors

              Array of extractors

            method extractSelectorsFromString

            extractSelectorsFromString: (
            content: RawContent[],
            extractors: Extractors[]
            ) => Promise<ExtractorResultSets>;
            • Extract the selectors present in the passed string using a PurgeCSS extractor

              Parameter content

              Array of content

              Parameter extractors

              Array of extractors

            method getPurgedCSS

            getPurgedCSS: (
            cssOptions: Array<string | RawCSS>,
            selectors: ExtractorResultSets
            ) => Promise<ResultPurge[]>;
            • Get the purged version of the css based on the files

              Parameter cssOptions

              css options, files or raw strings

              Parameter selectors

              set of extracted css selectors

            method purge

            purge: (
            userOptions: UserDefinedOptions | string | undefined
            ) => Promise<ResultPurge[]>;
            • Remove unused css

              Parameter userOptions

              PurgeCSS options

            method removeUnusedCSSVariables

            removeUnusedCSSVariables: () => void;
            • Remove unused CSS variables

            method removeUnusedFontFaces

            removeUnusedFontFaces: () => void;
            • Remove unused font-faces

            method removeUnusedKeyframes

            removeUnusedKeyframes: () => void;
            • Remove unused keyframes

            method walkThroughCSS

            walkThroughCSS: (root: any, selectors: ExtractorResultSets) => void;
            • Walk through the CSS AST and remove unused CSS

              Parameter root

              root node of the postcss AST

              Parameter selectors

              selectors used in content files

            Package Files (1)

            Dependencies (4)

            Dev Dependencies (1)

            Peer Dependencies (0)

            No peer dependencies.

            Badge

            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/purgecss.

            • Markdown
              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/purgecss)
            • HTML
              <a href="https://www.jsdocs.io/package/purgecss"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>