TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Single-line command to audit Accessibility score of a website

2 点作者 tpkahlon将近 2 年前
First, ensure you have Lighthouse installed globally by running &quot;npm i -g lighthouse&quot;.<p>Then, run the following script to audit any desired site against the accessibility test.<p>If the audit is successful, you will see &quot;Accessibility score is 100.&quot; printed in the terminal. Otherwise, it will list all the errors in the terminal which the site administrator can debug and patch.<p>site=&quot;https:&#x2F;&#x2F;google.ca&quot;; form_factor=&quot;--emulated-form-factor=desktop&quot;; accessibility_score=$(lighthouse --only-categories=accessibility &quot;$form_factor&quot; &quot;$site&quot; --quiet --output=json | jq -r &#x27;.categories.accessibility.score * 100&#x27;); if [[ $accessibility_score == 100 ]]; then echo &quot;Accessibility score is 100.&quot;; else (echo &quot;Accessibility score is $accessibility_score.&quot; &amp;&amp; lighthouse --only-categories=accessibility &quot;$form_factor&quot; &quot;$site&quot; --quiet --output=json | jq &#x27;.audits | to_entries[] | select(.value.score == 0) | .value.details.items&#x27;) fi<p>NOTE:<p>a) You can audit the test for either &quot;desktop&quot; or &quot;mobile&quot; by setting the &quot;--emulated-form-factor&quot; flag to the desired value.

暂无评论

暂无评论