How to identify unused css definitions [closed]

2018-12-31 17:17发布

Are there any good approaches to help identify unused css definitions in a project? A bunch of css files were pulled in and now I'm trying to clean things up a bit.

9条回答
像晚风撩人
2楼-- · 2018-12-31 17:51

Chrome Developer Tools has an Audits tab which can show unused CSS selectors.

Run an audit, then, under Web Page Performance see Remove unused CSS rules

enter image description here

查看更多
素衣白纱
3楼-- · 2018-12-31 17:51

Check out Google's PageSpeed for Firefox. It does this, and a whole load more.

Apparently a Chrome plugin is under development as well.

查看更多
其实,你不懂
4楼-- · 2018-12-31 17:57

CSS Usage

Firebug extension to view which CSS rules are actually used.

CSS Usage is an extension for Firebug (thus necessary to have Firebug installed) that allows you to know unused CSS style rules. It identifies the CSS you use and don’t use. It enables you to point out what unnecessary parts can be removed. You should definitely use this add-on to keep your CSS files as lightweight as possible.

查看更多
登录 后发表回答