可以使用Chrome开发者工具审核多个页面吗? [英] Is it possible to audit multiple pages with Chrome Developer tools?
问题描述
我试图在我的网站上找出未使用的CSS类,然后发现Chrome开发人员工具中有一个审核功能,该功能会标记未使用的CSS类。但是,一次只能打印一页。有办法让它审核多个页面,以便找出所有页面未使用的CSS类吗?
I am trying to find out unused CSS class in my website, and then I found that there is a audit function in Chrome developer tools that will mark unused CSS classes. However, it is only doing one page at a time. Is there a way to make it audit multiple pages so that I can find out CSS classes that are not used in all pages?
我知道有一个Firefox插件Dust-我做的工作。我只是想问一问我是否可以单独使用Chrome来做到这一点,因为我对Chrome Developer工具更加熟悉。
I know there is a Firefox plugin Dust-Me that do the job. I am asking just to find if I can do that with Chrome alone, as I am more familiar with Chrome Developer tools.
推荐答案
DevTools仅针对当前打开的页面运行,所以我的直觉是不可以。
DevTools only runs against the currently-open page, so my hunch is, no.
您可以安装灯塔 CLI(它使用与DevTools相同的后端来查找未使用的CSS),然后通过Bash脚本针对网址列表运行Lighthouse。
You could install the Lighthouse CLI (it uses the same backend for finding unused CSS as DevTools) and then run Lighthouse against a list of URLs via a Bash script.
urls=("a.com" "b.com" "c.com")
for url in $urls; do
lighthouse $url
done
这篇关于可以使用Chrome开发者工具审核多个页面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!