# gulp-purgecss

> Gulp plugin for purgecss

Latest version **9.1.0** (published 2026-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-purgecss
pnpm add gulp-purgecss
yarn add gulp-purgecss
bun add gulp-purgecss
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.1.0 |
| Published | 2026-11-07 |
| First published | 2017-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.12.0 |
| Dependencies | 5 |
| Unpacked size | 17 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8054 |
| Author | Ffloriel |
| Maintainers | jsnanigans, ffloriel |
| Keywords | optimize, optimization, remove, unused, css, gulpplugin, gulp, plugin, purge, uncss |

## Links

- npm: https://www.npmjs.com/package/gulp-purgecss
- Repository: https://github.com/FullHuman/purgecss
- Homepage: https://purgecss.com
- Issues: https://github.com/FullHuman/purgecss/issues
- npm.io page: https://npm.io/package/gulp-purgecss

## Dependencies (5)

- [purgecss](https://npm.io/package/purgecss.md) ^9.1.0
- [through2](https://npm.io/package/through2.md) ^5.0.12
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.3.3
- [plugin-error](https://npm.io/package/plugin-error.md) ^2.0.1
- [vinyl-sourcemaps-apply](https://npm.io/package/vinyl-sourcemaps-apply.md) ^0.2.1

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 9.1.0 (latest) — 2026-11-07
- 3.1.3-alpha.0 (next) — 2020-12-15
- 9.0.0 — 2026-11-06
- 8.0.0 — 2026-01-24
- 7.0.2 — 2024-11-21
- 7.0.1-alpha.0 — 2024-11-21
- 6.0.0 — 2024-03-29
- 6.0.0-alpha.0 — 2023-04-23
- 5.0.0 — 2022-09-13
- 4.1.3 — 2021-11-29
- 4.1.2 — 2021-11-29
- 4.1.1 — 2021-11-28
- 4.1.0 — 2021-11-28
- 4.0.3 — 2021-03-20
- 4.0.2 — 2021-02-21
- … 34 more at https://npm.io/package/gulp-purgecss/versions

## README

# gulp-purgecss

[![npm](https://img.shields.io/npm/v/gulp-purgecss.svg)](https://www.npmjs.com/package/gulp-purgecss)
[![license](https://img.shields.io/github/license/fullhuman/gulp-purgecss.svg)]()


> [gulp](http://gulpjs.com/) plugin to removed unused CSS, using [purgecss](https://github.com/FullHuman/purgecss)

## Regarding Issues

This is just a simple [gulp](https://github.com/gulpjs/gulp) plugin, which means it's nothing more than a thin wrapper around `purgecss`. If it looks like you are having CSS related issues, please go to the [purgecss](https://github.com/FullHuman/purgecss/issues) repo. Only create a new issue if it looks like you're having a problem with the plugin itself.

## Install

```
npm i -D gulp-purgecss
npm install --save-dev gulp-purgecss
```

## Usage

By default, `purgecss` outputs the source CSS _with unused selectors removed_:

```js
const gulp = require('gulp')
const purgecss = require('gulp-purgecss')

gulp.task('purgecss', () => {
    return gulp.src('src/**/*.css')
        .pipe(purgecss({
            content: ['src/**/*.html']
        }))
        .pipe(gulp.dest('build/css'))
})
```

By setting the `rejected` option, you can 'invert' the output to list _only the removed selectors_: 

```js
const gulp = require('gulp')
const rename = require('gulp-rename')
const purgecss = require('gulp-purgecss')

gulp.task('purgecss-rejected', () => {
    return gulp.src('src/**/*.css')
        .pipe(rename({
            suffix: '.rejected'
        }))
        .pipe(purgecss({
            content: ['src/**/*.html'],
            rejected: true
        }))
        .pipe(gulp.dest('build/css'))
})
```

## Versioning

We use [SemVer](http://semver.org/) for versioning. 

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

---
_Source: https://npm.io/package/gulp-purgecss · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
