检测未使用的CSS规则 [英] Detect unused CSS rules

查看:108
本文介绍了检测未使用的CSS规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:


我正在开发一个网站。

我使用现成的template.this模板包含许多带有许多css规则的css文件。

但是我有几个页面,我确信我没有使用所有选择器。

是否有任何工具可以扫描项目HTML文件并找到未使用的CSS规则并删除它们?


我找到
此问题说:


Dust-me Selectors 是一个可以找到未使用的选择器的firefox插件。


但它不兼容FF6,

解决方案

您可以使用chrome的开发人员工具获得一个大致的想法。 p>


  1. 在Chrome中打开页面

  2. 打开开发者工具(Ctrl + Shift + I)

  3. 打开审核标签

  4. 点击运行

  5. 展开删除未使用的CSS规则项目以查看样式列表


  6. 这不会列出哦等待... ... XD


    Possible Duplicate:
    How can I find unused images and CSS styles in a website?

    I am developing a website.
    I use ready template.this template contains many css files with many css rules.
    But I have few pages and I am sure I didn't use all selectors.
    Is there any tool exist for scanning project HTML files and finding unused css rules and remove them ?
    I found this question that says :

    Dust-me Selectors is a firefox plugin that finds unused selectors.

    But its not compatible with FF6 and seems it just review current viewing page and not scans whole website files.

    解决方案

    You can get a general idea with chrome's developer tools.

    1. Open the page in Chrome
    2. Open developer tools (Ctrl+Shift+I)
    3. Open the Audits tab
    4. click run
    5. expand the "Remove unused CSS rules" item to view a list of style sheets that contain unused style rules.

    This doesn't list them out oh wait... it does... XD

    这篇关于检测未使用的CSS规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆