CSS-libraries like Bootstrap and jQuery UI are used in my current project. It's obvious that most of the rules from these libraries aren't used, so I was wondering is there a way, using some tool, to remove unused rules from the final CSS bundle when I'm making a release build using Visual Studio?
Asked
Active
Viewed 292 times
1 Answers
1
This article here on KeyCDN seems to have a lot of great options
I'll quickly mention here from that article that you can see for yourself in Chrome Dev Tools which rules are not being applied:
- Open Chrome Dev Tools, and go to the Sources tab
- Open the command menu
- Type in “Coverage” and click on the “Show Coverage” option
- Select a CSS file from the Coverage tab which will open the file up in the Sources tab
Any CSS that is next to a solid green line means that the code was executed. Solid red means it did not execute. A line of code that is both red and green, means that only some code on that line executed.

Andrew Shearer
- 268
- 4
- 17
-
Should the removing of red lines be done manually? Or is there a way to automatically do it in Developer Tools? – Basj Feb 04 '22 at 00:58