UnCSS is a tool that removes unused CSS from your stylesheets. It works across multiple files and supports Javascript-injected CSS.
How?
The process by which UnCSS removes the unused rules is as follows:
1. The HTML files are loaded by jsdom and JavaScript is executed.
2. All the stylesheets are parsed by PostCSS.
2. document.querySelector filters out selectors that are not found in the HTML files.
4. The remaining rules are converted back to CSS.
Please note:
• UnCSS cannot be run on non-HTML pages, such as templates or PHP files. If you need to run UnCSS against your templates, you should probably generate example HTML pages from your templates, and run uncss on those generated files; or run a live local dev server, and point uncss at that.
• UnCSS only runs the Javascript that is run on page load. It does not (and cannot) handle Javascript that runs on user interactions like button clicks. You must use the ignore option to preserve classes that are added by Javascript on user interaction.
Looking for other UnCSS-like programs? We've rounded up our favorites UnCSS alternatives. Try any one of these fan favorites to see if they'll support your system and meet your specific needs.
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...
What is Purgecss? When you are building a website, chances are that you are using a CSS framework like Bootstrap, Materializecss, Foundation, etc... But you will only...
A function that takes content (HTML/JS/PHP/etc) and CSS, and returns only the used CSS. PurifyCSS does not modify the original CSS files. You can write to a new file...
Add your reviews & share your experience when using UnCSS to the world. Your opinion will be useful to others who are looking for the best UnCSS alternatives.
Table of Contents
Popular Alternatives
iOS Alternatives
Android Alternatives
Copyright © 2021 TopAlter.com
Sites we Love: AnswerBun, MenuIva, UKBizDB, Sharing RPP