Run chrome lighthouse's audit from command line

后端 未结 2 1247
旧巷少年郎
旧巷少年郎 2021-02-14 17:57

I would like to write a script which run (from the chrome\'s binary) its lighthouse\'s audit with a url given. I didn\'t manage to find how to do it, but since ther

2条回答
  •  天命终不由人
    2021-02-14 18:38

    You can use/test via npx:

    npm i npx -g
    

    Then, directly run from your terminal without using a package.json created or installing globally & without opening a chrome browser instance:

    npx lighthouse  --only-categories="performance,seo,Accessibility" --chrome-flags="--headless"
    

提交回复
热议问题