UNPKG

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