TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

2 pointsby tpkahlonalmost 2 years ago
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.

no comments

no comments