问题
Before publishing a site I have bloat of unused CSS styles. Is there any good tool to detect unused CSS classes, divs?
Related Questions:
- Tool to identify unused css definitions
- Are there any utilites that will help me refactor CSS
回答1:
You can try CSS Tidy:
http://csstidy.sourceforge.net/
It is simple yet effective.
回答2:
Use this firefox plugin to find which of your css styles are not being utilized. http://blog.brothersmorrison.com/?p=198
or get it from Mozilla https://addons.mozilla.org/en-US/firefox/addon/css-roundup/
回答3:
Here is a simple web based css optimizer, very useful: http://www.cleancss.com/
回答4:
Try ProCSSor
回答5:
Make sure you have firebug (for Firefox, if you don't know), and then install the pagespeed plugin for firebug, developed by Google:
http://code.google.com/speed/page-speed/
It will give you a 'pageSpeed' tab in firebug. Open it and, with 'performance' selected, click 'analyze performance'. Along with lots of other useful suggestions, you will get a list item labelled "Remove Unused Css". Click to expand it and see a breakdown by resource of unused css rules appearing on the present page, along with the memory size that you will save by removing the unused rules.
来源:https://stackoverflow.com/questions/672786/tool-for-cleaning-up-css