Purgecss Versions Save

Remove unused CSS

v6.0.0

2 weeks ago

Bug Fixes

Features

Breaking changes

  • Supports NodeJS 18+

What's Changed (full list)

New Contributors

Full Changelog: https://github.com/FullHuman/purgecss/compare/v5.0.0...v6.0.0

v5.0.0

1 year ago

Bug Fixes

  • add safelist variables to postcss-purgecss #840 (c822058)
  • gulp-purgecss: support skippedContentGlobs option #853 (b72de77)
  • Purgecss webpack plugin/only filter fix (#933) (f8e4c2c)
  • purgecss-webpack-plugin: add sourcemap support #409 (b3f73ed)
  • purgecss-webpack-plugin: export as named export as well as default (#821) (a6a2c8e)
  • wrong path import (4f3ddd0)

Features

  • add source map support #526 (f2a9c5a)
  • gulp-purgecss: add support for gulp-sourcemaps #257 (55c26d2)
  • postcss-purgecss: load options from purgecss config (4de3bd8)
  • purgecss-webpack-plugin: load config file automatically #767 (726faaa)

BREAKING CHANGES

  • purgecss-webpack-plugin: drop webpack 4 support

What's Changed (generated commit list minus dependabot)

New Contributors

Full Changelog: https://github.com/FullHuman/purgecss/compare/v4.1.3...v5.0.0

v4.1.0

2 years ago

Bug Fixes

  • Allow Absolute Paths (#679) (15335a2)
  • css variable removed when declared in wrong order (89ece42), closes #518
  • Fix interaction with other plugins (#647) (fb08e3a)
  • grunt-purgecss: Fix plugin not ouputting all files (#723) (646e419)
  • gulp-purgecss: fix support for stream input (fd5d3bf)
  • Keep keyframe decimals for prefixed @keyframes (#749) (b804441)
  • purgecss-from-pug: class attribute with multiple values not correctly handled with pug (#678) (ba6285d), closes #677

Features

What's Changed

New Contributors

Full Changelog: https://github.com/FullHuman/purgecss/compare/v4.0.3...v4.1.0

v4.0.0

3 years ago

Breaking Changes

Drop PostCSS 7 support, use @fullhuman/postcss-purgecss 3.0 with PostCSS 7.

v3.1.3

3 years ago

Changes

  • postcss-purgecss remove postcss 8 as peer dependency
  • purgecss-webpack-plugin fix backward compatibility with webpack 4
  • PurgeCSS Update to PostCSS 8
  • postcss-purgecss Add compatibility with PostCSS 8
  • purgecss-webpack-plugin Fix deprecation warning with Webpack 5

Bug Fixes

v3.0.0

3 years ago

3.0.0

Simplifying whitelist option

Whitelist started as a simple option named whitelist but grew up with the different use-cases and needs that appear with time. Another option called whitelistPatterns appeared, then whitelistPatternsChildren, … It is now more complex and complicated, and somewhat difficult to remember how to use it with different options.

To summarize the changes, the whitelist options are now grouped in one option called safelist. And the most used options can be defined in one array.

Two forms are available. The simple form is:

safelist: ['invisibleClass', /^nav-/]

In this form, safelist is an array that can take a string or a regex.

The complex form is:

safelist: {
 standard: ['invisibleClass', /^nav-/],
 deep: [],
 greedy: [],
 keyframes: [],
 variables: []
}

In this form, safelist is an object taking optional properties: standard is the same as the simple form and replaces whitelist and whitelistPatterns deep replaces whitelistPatternsChildren greedy is a new option coming from https://github.com/FullHuman/purgecss/pull/424 keyframes can be used to add keyframes to the safelist, when using keyframes: true (https://github.com/FullHuman/purgecss/issues/418) variables can be used to add CSS variables to the safelist, when using variables: true

New Option: Blocklist

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.

blocklist: ['usedClass', /^nav-/]

Even if nav-links and usedClass are found in your content files (HTML, Javascript), they will be removed.

CLI

PurgeCSS is using commander.js for its CLI. The recent version of commander.js introduced the possibility of making an option variadic. This means when specifying multiple option arguments, the parsed option value will be an array. A few options are now taking advantage of this new feature: content, css, and the newly introduced option safelist and blocklist. It is no longer necessary to separate the list items with a comma.

From changelog:

  • CLI: add blocklist option (3961afb)
  • add blocklist option (04223f7)
  • add safelist option, replace whitelist
  • add safelist keyframes and css variables (dc59d30), closes #418 #439

v2.0.5

4 years ago

Changes:

  • Asynchronous
import PurgeCSS from "purgecss";

const purgecssResults = await new PurgeCSS().purge({
    // options
});
  • Extractor is a function
content => content.match(/[\w-/:]+(?<!:)/g) || []
  • variables option to remove unused CSS variables
  • Drop support of NodeJS < 8

1.4.2

4 years ago

1.4.1

4 years ago
  • Merge pull request #210, ability to exclude current rule with a ignore comment placed inside of it
  • Merge pull request #229, Fix the config file path of windows
  • update dependencies

1.4.0

4 years ago