Is it possible to audit multiple pages with Chrome Developer tools?

安稳与你 提交于 2020-01-12 18:50:34

问题


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?

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.


回答1:


DevTools only runs against the currently-open page, so my hunch is, no.

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


来源:https://stackoverflow.com/questions/42685819/is-it-possible-to-audit-multiple-pages-with-chrome-developer-tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!