UNPKG

3.07 kBMarkdownView Raw
1# PurgeCSS
2
3[![npm](https://img.shields.io/npm/v/purgecss?style=for-the-badge)](https://www.npmjs.com/package/purgecss)
4![npm](https://img.shields.io/npm/dm/purgecss?style=for-the-badge)
5![GitHub](https://img.shields.io/github/license/FullHuman/purgecss?style=for-the-badge)
6![Dependabot](https://img.shields.io/badge/dependabot-enabled-%23024ea4?style=for-the-badge)
7[![Coverage Status](https://img.shields.io/coveralls/github/FullHuman/purgecss/main?style=for-the-badge)](https://coveralls.io/github/FullHuman/purgecss?branch=main)
8
9<p align="center">
10 <img src="https://i.imgur.com/UEiUiJ0.png" height="200" width="200" alt="PurgeCSS logo"/>
11</p>
12
13## What is PurgeCSS?
14
15When 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.
16
17This is where PurgeCSS comes into play. PurgeCSS analyzes your content and your css files. Then it matches the selectors used in your files with the one in your content files. It removes unused selectors from your css, resulting in smaller css files.
18
19## Sponsors 🥰
20
21[<img src="https://avatars0.githubusercontent.com/u/67109815?v=4" height="85" style="margin-right: 10px">](https://tailwindcss.com)
22[<img src="https://avatars.githubusercontent.com/u/133211198?v=4" height="85" style="margin-right: 10px">](https://www.bairesdev.com/sponsoring-open-source-projects/)
23
24## Documentation
25
26You can find the PurgeCSS documentation on [this website](https://purgecss.com).
27
28### Table of Contents
29
30#### PurgeCSS
31
32- [Configuration](https://purgecss.com/configuration.html)
33- [Command Line Interface](https://purgecss.com/CLI.html)
34- [Programmatic API](https://purgecss.com/api.html)
35- [Safelisting](https://purgecss.com/safelisting.html)
36- [Extractors](https://purgecss.com/extractors.html)
37- [Comparison](https://purgecss.com/comparison.html)
38
39#### Plugins
40
41- [PostCSS](https://purgecss.com/plugins/postcss.html)
42- [Webpack](https://purgecss.com/plugins/webpack.html)
43- [Gulp](https://purgecss.com/plugins/gulp.html)
44- [Grunt](https://purgecss.com/plugins/grunt.html)
45- [Gatsby](https://purgecss.com/plugins/gatsby.html)
46
47#### Guides
48
49- [Vue.js](https://purgecss.com/guides/vue.html)
50- [Nuxt.js](https://purgecss.com/guides/nuxt.html)
51- [React.js](https://purgecss.com/guides/react.html)
52- [Next.js](https://purgecss.com/guides/next.html)
53- [Razzle](https://purgecss.com/guides/razzle.html)
54
55## Getting Started
56
57#### Installation
58
59```
60npm i --save-dev purgecss
61```
62
63## Usage
64
65```js
66import PurgeCSS from "purgecss";
67const purgeCSSResults = await new PurgeCSS().purge({
68 content: ["**/*.html"],
69 css: ["**/*.css"],
70});
71```
72
73## Contributing
74
75Please read [CONTRIBUTING.md](./../../CONTRIBUTING.md) for details on our code of
76conduct, and the process for submitting pull requests to us.
77
78## Versioning
79
80PurgeCSS use [SemVer](http://semver.org/) for versioning.
81
82## License
83
84This project is licensed under the MIT License - see the [LICENSE](./../../LICENSE) file
85for details.