EXPERIMENTAL tool to find unused/redundant CSS rules.
Having a live styleguide offers great benefits to any dynamic website. But sometimes it can be hard to know if your styleguide is truly comprehensive. Does it actually exercise every bit of styling specified in your local CSS files? Or from the opposite perspective, do you have CSS rules that are no longer needed?
See also - CSS Purge which has provided inspiration for lots of these warnings/violations.
- Tell witchhunt where to find your site's styleguide
- witchhunt will find site-local CSS files referenced from this
- The styleguide page and any site-local pages linked from it will then be checked against all the site-local CSS rules
- Any local rules that are not matched will be reported
- Any local rules that are redundant will be reported
Building the executable
Preconditions: you have a working SBT stack (i.e. Java and SBT installed)
% sbt stage
Running the executable
On UNIX-like systems:
% ./target/universal/stage/bin/witchhunt [options] <target-url>
On Windows systems:
% ./target/universal/stage/bin/witchhunt.bat [options] <target-url>
witchhunt with no arguments to get the up-to-date list.
- Detect and parse
.mapfiles and use them to give correct locations in LESS and SASS pre-processor files
- Warn about excessive nesting a.k.a The Inception Rule (3 levels down)
- Warn about excessive colors
- Warn about excessive media querying
- Warn about excessive numbers of style links
- Warn about excessive numbers of font sizes
- Warn about excessive numbers of font families
- Warn about excessive specificity
PH-CSS: Parsing CSS stylesheets