Skip to content

Instantly share code, notes, and snippets.

@alexander-bobin
Created July 13, 2017 03:20
Show Gist options
  • Select an option

  • Save alexander-bobin/c5ede25397d5687dd0276d9737f4610f to your computer and use it in GitHub Desktop.

Select an option

Save alexander-bobin/c5ede25397d5687dd0276d9737f4610f to your computer and use it in GitHub Desktop.
url=${1:-http://localhost:8080/us/rock-n-roll-dallas/sammy}
output_path="./.lighthouse/$(date +%F-%S.%M).json"
NODE_ENV=production yarn build && NODE_ENV=production yarn start > dev.log &
# may need to wait for port
yarn run lighthouse ${url} -- --output="json" --output-path="${output_path}"
kill $(lsof -i :8080 -t)
meaningful_paint=$(jq '.audits | .["first-meaningful-paint"] | .rawValue' ${output_path})
speed_index=$(jq '.audits | .["speed-index-metric"] | .rawValue' ${output_path})
first_interactive=$(jq '.audits | .["first-interactive"] | .rawValue' ${output_path})
echo "First meaningful paint (ms): ${meaningful_paint}"
echo "Speed index metric (ms): ${speed_index}"
echo "First interactive (ms): ${first_interactive}"
rm ${output_path}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment