MCPcopy
hub / github.com/FullHuman/purgecss

github.com/FullHuman/purgecss @v8.0.0 sqlite

repository ↗ · DeepWiki ↗ · release v8.0.0 ↗
155 symbols 455 edges 112 files 40 documented · 26%
README

PurgeCSS

npm npm GitHub Dependabot

<img src="https://i.imgur.com/UEiUiJ0.png" height="200" width="200" alt="PurgeCSS logo"/>

What is PurgeCSS?

When you are building a website, chances are that you are using a css framework like Bootstrap, Materializecss, Foundation, etc... But you will only use a small set of the framework and a lot of unused css styles will be included.

This is where PurgeCSS comes into play. PurgeCSS analyzes your content and your css files. Then it matches the selectors used in your css files with the ones in your content files. It removes unused selectors from your css, resulting in smaller css files.

Sponsors 🥰

Documentation

You can find the PurgeCSS documentation on this website.

Table of Contents

PurgeCSS

Plugins

Guides

Getting Started

Installation

npm install purgecss --save-dev

Usage

import { PurgeCSS } from "purgecss";
const purgeCSSResults = await new PurgeCSS().purge({
  content: ["**/*.html"],
  css: ["**/*.css"],
});

Packages

This repository is a monorepo that we manage using Lerna. That means that we actually publish several packages to npm from the same codebase, including:

Package Version Description
purgecss npm The core of PurgeCSS
postcss-purgecss npm (scoped) PostCSS plugin for PurgeCSS
purgecss-webpack-plugin npm Webpack plugin for PurgeCSS
gulp-purgecss npm Gulp plugin for PurgeCSS
grunt-purgecss npm Grunt plugin for PurgeCSS
rollup-plugin-purgecss npm Rollup plugin for PurgeCSS
purgecss-from-html npm Html extractor for PurgeCSS
purgecss-from-pug npm Pug extractor for PurgeCSS
purgecss-with-wordpress npm Collection of safelist items for WordPress
vue-cli-plugin-purgecss npm Vue CLI Plugin for PurgeCSS

Extension points exported contracts — how you extend this code

UserDefinedOptions (Interface)
(no doc)
packages/postcss-purgecss/src/types/index.ts
UserDefinedOptions (Interface)
(no doc)
packages/gulp-purgecss/src/types/index.ts
AtRules (Interface)
(no doc)
packages/purgecss/src/types/index.ts
JSXAttribute (Interface)
(no doc)
types/acorn-jsx/index.d.ts
RawContent (Interface)
(no doc)
packages/purgecss/src/types/index.ts
JSXOpeningElement (Interface)
(no doc)
types/acorn-jsx/index.d.ts
RawCSS (Interface)
(no doc)
packages/purgecss/src/types/index.ts
JSXAttributeExpression (Interface)
(no doc)
types/acorn-jsx/index.d.ts

Core symbols most depended-on inside this repo

purge
called by 61
packages/purgecss/src/index.ts
mergeSets
called by 13
packages/purgecss/src/ExtractorResultSets.ts
buildRollup
called by 11
scripts/build.ts
createConfig
called by 10
jest.config.ts
createRollupConfig
called by 10
scripts/build.ts
parseCommandOptions
called by 9
packages/purgecss/src/bin.ts
extractAPI
called by 9
scripts/build.ts
run
called by 6
packages/purgecss/src/bin.ts

Shape

Function 68
Method 41
Interface 36
Class 10

Languages

TypeScript100%

Modules by API surface

packages/purgecss/src/index.ts39 symbols
types/acorn-jsx/index.d.ts26 symbols
packages/purgecss/src/ExtractorResultSets.ts14 symbols
packages/purgecss/src/VariablesStructure.ts11 symbols
packages/purgecss-webpack-plugin/src/index.ts10 symbols
packages/purgecss/src/types/index.ts8 symbols
packages/purgecss/src/bin.ts6 symbols
packages/purgecss-from-jsx/src/index.ts6 symbols
packages/purgecss-from-html/src/index.ts4 symbols
scripts/build.ts3 symbols
packages/postcss-purgecss/src/index.ts3 symbols
packages/rollup-plugin-purgecss/src/index.ts2 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@eslint/eslintrc3.1.0 · 1×
@eslint/js9.11.1 · 1×
@fullhuman/purgecss-from-jsx8.0.0 · 1×
@microsoft/api-documenter7.25.14 · 1×
@microsoft/api-extractor7.47.9 · 1×
@rollup/plugin-json6.1.0 · 1×
@rollup/plugin-typescript12.1.0 · 1×
@types/event-stream4.0.0 · 1×
@types/glob9.0.0 · 1×
@types/grunt0.4.25 · 1×
@types/jest29.5.13 · 1×
@types/node25.0.10 · 1×

For agents

$ claude mcp add purgecss \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact