
DropCSS
A simple, thorough and fast unused-CSS cleaner
- Free • Open Source
- Self-Hosted
- CSS
What is DropCSS?
DropCSS is an unused CSS cleaner; it takes your HTML and CSS as input and returns only the used CSS as output. The core is simply some minimal glue between these awesome low-level tools:
• Fast HTML Parser • CSSTree • css-select
The entire logic for DropCSS is this ~60 line file.
It is recommended to also run your CSS through an optimizer like clean-css to group selectors, merge and remove redundant rules, purge unused keyframes, etc. Whether this is done before or after DropCSS is up to you, but since clean-css also minifies, it probably makes sense to run DropCSS first to avoid bouncing [and re-parsing] the output back and forth (optimize & minify -> drop) vs (optimize -> drop -> minify), though this will likely depend on your actual input; profiling is your friend.
A bit more on this project's backstory & discussions in /r/javascript and on Hacker News.
DropCSS Screenshots
DropCSS information
Supported Languages
- English
GitHub repository
- 2,126 Stars
- 65 Forks
- 12 Open Issues
- Updated
Comments and Reviews
Tags
- development
- css-development
- unused-css
- css3
- CSS / Stylesheets