Purge CSS standalone application
Prerequisites
- [x] I have searched for duplicate or closed feature requests
- [x] I have read the contributing guidelines
Proposal
According to PageSpeed there is significant CSS bloat in my website. This is bad for SEO and also increases download time and computational requirements and memory requirements for my website.
Motivation and context
I ran my homepage through Purify CSS Online. Purify CSS indicated that 84% of the CSS provided by Bootstrap 5.3.6 is unnecessary. Purifying my CSS file would reduce it from 226 kB down to 37 kB.
My suggested resolution is a single executable file that performs the same function as Purify CSS. This could be used as part of the build process for many static site generators such as Zola and Hugo.
Personally, I don’t think it's Bootstrap's role to provide and maintain this functionality; tools like PurgeCSS already serve that purpose effectively with a programmatic API, but also a CLI. We recommend using those solutions in our Customize > Optimize > Unused CSS section.
Yeah it's also hard to have a singular script that works for every project—there are so many differences between frameworks, languages, platforms, file locations, etc. Perhaps there's more we can front up with a guide or something on getting PurgeCSS setup? We have some of that in our examples—see https://github.com/twbs/examples/tree/main/icons-font.
You can use the PurgeCSS CLI to do the same. Its just a one line command.