Bug 141599 - Web Inspector: CSS Report: Unused / dead code
Summary: Web Inspector: CSS Report: Unused / dead code
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-02-13 21:53 PST by Joseph Pecoraro
Modified: 2016-12-13 15:38 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-02-13 21:53:51 PST
* SUMMARY
CSS Report: Unused / dead code.

When we do Reports, a useful CSS report feature to have would be warning about unused rules, or dead code within stylesheets.

Examples:
- warn about unused rules (could be dead code, or could just not be affecting this page)
- warn about explicitly dead code, overruled within the styles:
  "b{color:red} b{color:blue}" => the first rule is dead code and can be eliminated
  ".a.b{...} .b.a{...}" => more complex, but these two selectors match, possible dead code

Doing a quick web search, there are tools that do similar things:
- css-eliminator <https://www.npmjs.com/package/css-eliminator>
- uncss - <http://davidwalsh.name/uncss>
- unused-css - <https://unused-css.com> (I think this actually checks on multiple pages to essentially get code-coverage of a stylesheet across many pages)
- cssess - <http://razorfast.com/2010/11/21/announcing-cssess-the-bookmarklet-that-finds-unused-css-selectors/>
- helium-css - <https://github.com/geuis/helium-css>
- deadweight - <https://github.com/aanand/deadweight>
- CSS Scanner - <http://sourceforge.net/projects/cssscanner/>
Comment 1 Radar WebKit Bug Importer 2015-02-13 21:54:04 PST
<rdar://problem/19837134>