JSPM

  • Created
  • Published
  • Downloads 1079084
  • Score
    100M100P100Q181105F
  • License MIT

Remove unused css selectors.

Package Exports

  • purgecss

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (purgecss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Purgecss

Build Status CircleCi dependencies Status devDependencies Status Codacy Badge Codacy Badge

Purgecss logo

Getting Started

Installation

npm i --save-dev purgecss

Documentation

Usage

import Purgecss from "purgecss"
import purgeHtml from "purgecss-from-html"
const purgeCss = new Purgecss({
    content: ["**/*.html"],
    css: ["**/*.css"],
    extractors: [
        {
            extractor: purgeHtml,
            extensions: ["html"]
        }
    ]
})
const result = purgecss.purge()

Build Plugin

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.

License

This project is licensed under the MIT License - see the LICENSE file for details

Troubleshooting

Wrong extractor is selected

The extractors needs to be defined from the more specific to the less specific. Meaning that you need to define js extractor after ejs. So the js extractor will not be selected for ejs files.

You can specified extensions like .es.js.

Some unused css are not removed

If you are using the default or legacy extractor, look here. Head over the repository of the extractor and open an issue. Be as precise as possible when describing the issue, provide the css file and content file if possible.