-3

So I’m in the middle of fiddling around with a site and I notice it’s full of old code and IE style resets/hacks/polyfills etc. all of which it’s not necessary to support anymore.

Rather than me trawling through thousands of lines of CSS, is there a simple, efficient and safe way to detect and remove old styles from a stylesheet?

I’m talking _background: gray; -ms-filter:; -WebKit-border-radius:; and all the other proprietary things from back in the day.

This site will support modern browsers only, using standard CSS3 selectors and attributes, so if I can find a way to parse and either automatically remove or at least give me line numbers for the antiquated code, that’d save me a huge amount of time (and save me having to start from scratch!!!)

Thanks in advance guys!

  • Your browser's inspector should show you what css is being applied to an element, along with the line number (assuming that css wasn't minified - if all the styles are on line 1, this is likely the case) – Thomas Skubicki Jan 10 '19 at 22:01
  • Thanks @thomas-skubicki - Appreciate this is an old thread now! I was hoping to find a way to review the CSS at a high level, without having to go through element by element and manually tracking styles. On a site (a blog in this case) with hundreds of posts and multiple different page styles, the number of elements to keep track of is large. I found Project Wallace which doesn’t automate the “cleansing” of CSS, but it does give great insight into CSS, browser hacks, cohesion, complexity etc. – willstocks_ Feb 05 '19 at 23:36

1 Answers1

0

I found an incredibly useful tool: https://www.projectwallace.com/

It doesn’t strip CSS, but gives a good overview!!!