You only need Docker installed. Add to ~/.zshrc
, or ~/.bashrc
, or whatever you're using;
lh() {
mkdir -p lighthouse && \
docker run --rm -it -v "$PWD":/usr/src -w /usr/src markhobson/node-chrome /bin/bash -c "npm i -g lighthouse && lighthouse --enable-error-reporting --chrome-flags=\"--headless --no-sandbox\" $1 --output html --output-path ./lighthouse/index.html" && \
open lighthouse/index.html
}