Say you had a dynamically generated site that has been worked on by too many people, past and present, and you now have a collection of shared stylesheets that contain over
Check for PurifyCSS, and this for those who can handle CLI or Gulp/Grunt/Webpack
You can remove the unused style from single page or multiple page or from the entire project, even though the classes are being injected by javascript.
If you can google, there are tons of resources out there from which you can learn about PurifyCSS.