DEV Community

Cover image for Audit your sites 10X faster with Unlighthouse
Jyothikrishna
Jyothikrishna

Posted on

Audit your sites 10X faster with Unlighthouse

Introduction

Lighthouse is a powerful tool for auditing the performance, accessibility, and best practices of web pages. It is built into Chrome DevTools and can be used to audit individual pages or entire websites.

Unlighthouse is an open-source tool that builds on top of Lighthouse to provide a number of advantages, including:

  • Speed: Unlighthouse is significantly faster than Lighthouse, especially for auditing large websites.
  • Scalability: Unlighthouse can audit websites of any size, while Lighthouse can struggle to audit large websites without crashing.
  • Ease of use: Unlighthouse has a user-friendly interface that makes it easy to configure and run audits.
  • Extensibility: Unlighthouse is open source and extensible, so you can customize it to meet your specific needs.

Additionally, Unlighthouse allows you to audit multiple routes at a time, which is not possible with Lighthouse.

How to use Unlighthouse CLI

The Unlighthouse CLI is a command-line tool that allows you to run Unlighthouse audits from your terminal. This is useful for automating audits and integrating Unlighthouse into your CI/CD pipeline.

To use the Unlighthouse CLI, you will need to install Unlighthouse globally. You can do this with the following command:

npm install -g unlighthouse
Enter fullscreen mode Exit fullscreen mode

Once Unlighthouse is installed, you can run an audit on your website using the following command:

npx unlighthouse --site <your-site>
# OR pnpm dlx unlighthouse --site <your-site>
Enter fullscreen mode Exit fullscreen mode

For example, to run an audit on the my portfolio, you would use the following command:

npx unlighthouse --site https://jyothikrishna.vercel.app 
Enter fullscreen mode Exit fullscreen mode

If you run it you will unlighthouse audit my portfolio and it will display the output on localhost:5678. Here is an demo pic for your reference 👇

Image description

The Unlighthouse CLI also supports a number of other options. You can see a list of all the options by running the following command:

npx unlighthouse --help
Enter fullscreen mode Exit fullscreen mode

Here are some examples of how to use the Unlighthouse CLI to audit a website with 5-10 routes:

To audit all of the routes on your website, you can use the following command:

npx unlighthouse --sitemaps https://your-website.com/sitemap.xml
Enter fullscreen mode Exit fullscreen mode

To audit a specific subset of routes on your website, you can use the --include and --exclude options. For example, to exclude about route on your website, you would use the following command:

npx unlighthouse --site <siteURL> --exlude about
Enter fullscreen mode Exit fullscreen mode

To audit your website with different settings, you can use the --config option. For example, to audit your website with the mobile settings, you would use the following command:

npx unlighthouse --site <siteURL> --config chrome-mobile.config.json
Enter fullscreen mode Exit fullscreen mode

I encourage you to experiment with the Unlighthouse CLI to see how it can meet your specific needs. Here is the link to official docs.

Conclusion

Unlighthouse is a powerful tool that can help you improve the quality of your website. It is faster, more scalable, and easier to use than Lighthouse. The Unlighthouse CLI is also a great option for automating audits and integrating Unlighthouse into your CI/CD pipeline.

If you are auditing a website with 5-10 routes or more, I highly recommend using Unlighthouse instead of Lighthouse. You will save a significant amount of time and frustration.

If you enjoyed reading this post and want to stay connected, make sure to check out my Linktree.

Happy Hacking

Top comments (1)

Collapse
 
dimeloper profile image
Dimitris Kiriakakis • Edited

Just FYI if you want to audit all of the routes on your website, given your sitemap, you need to use the following command (site needs to be included otherwise it fails):

npx unlighthouse --site https://your-website.com/ --sitemaps https://your-website.com/sitemap.xml
Enter fullscreen mode Exit fullscreen mode

Thank you for your article.