Skip to content

Instantly share code, notes, and snippets.

@EstebanMqz
Last active October 16, 2023 22:59
Show Gist options
  • Save EstebanMqz/a9405227a86e46bccf20851edb91f7f2 to your computer and use it in GitHub Desktop.
Save EstebanMqz/a9405227a86e46bccf20851edb91f7f2 to your computer and use it in GitHub Desktop.
LightHouse .bashrc regex HTML web-audit tool in .git remotes

LightHouse HTML

Regex .sh to generate a Google Lighthouse Web-Audit for an HTML file in cwd for the git remote (if any).

See Git-Commands

#!/bin/bash
# Regex shell script to execute a Google Lighthouse Audit for the HTML file in the cwd for the git remote repository.

html=$(find . -name "*.html" -print -quit | sed 's/^.\///')

if [ -z "$html" ]; then
  echo "Error: No HTML file found in the repository."
  exit 1
fi

remote_url=$(git config --get remote.origin.url | sed 's/\.git//')"/blob/main/$html"

start "https://googlechrome.github.io/lighthouse/viewer/?psiurl=https://htmlpreview.github.io/?"$remote_url

./LightHouse.sh
Generation
Usage e.g:

LightHouse

Description
Type: Bash Script ( .sh )
Usage: Shell Script to generate a Google LightHouse Web-Audit report for HTML in git remote repository without relying on user's http-protocol in OS-registry.
Author: Resume LinkedIn Business Gmail Github GitLab
Tags: Windows Regedit   Google Lighthouse Viewer   remote origin url find command start command git bash git version sed version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment