When 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. This 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 ones in your content files. It removes unused selectors from your CSS, resulting in smaller CSS files. PurgeCSS has a list of options that allow you to customize its behavior. Customization can improve the performance and efficiency of PurgeCSS. The configuration file is a simple JavaScript file. By default, the JavaScript API will look for purgecss.config.js. You can then use PurgeCSS with the config file. PurgeCSS also works with raw content. To do this, you need to pass an object with the raw property instead of a filename.
Features
- PurgeCSS can be adapted to suit your needs
- Programmatic API
- Command Line Interface
- It removes unused selectors from your CSS
- PurgeCSS also works with raw CSS
- You can specify content that should be analyzed by PurgeCSS