What Is Google Lighthouse and How to Use It? - Elegant ...
文章推薦指數: 80 %
Google Lighthouse is a free, open-source tool that can help you improve your website's speed, performance, and overall experience. Generating ...
Pricing
WhatIsGoogleLighthouseandHowtoUseIt?
PostedonJanuary4,2022byWillMorrisinWordPress|5comments
Asawebsiteowner,maximizingyoursite’sSearchEngineOptimization(SEO),accessibility,andperformanceisofutmostimportance.However,totacklethesefactorsasefficientlyaspossible,it’scrucialtoadopttherighttoolsandtechniques.OneofthemostinnovativesolutionsyoucancurrentlyleverageisGoogleLighthouse.
Inthispost,we’llintroduceyoutoGoogleLighthouseandhowitworks.Thenwe’llexplainhowyoucanuseittoimproveyoursite.
Let’sjumpin!
SubscribeToOurYoutubeChannel
WhatIsGoogleLighthouse?
GoogleLighthouseisafree,open-sourcetoolthatcanhelpyouimproveyourwebsite’sspeed,performance,andoverallexperience.GeneratingLighthousereportsmakesiteasiertoenhancethequalityofyourwebpages.
Thereareafewdifferentwaysyoucanusethetool.Youcanrunitvia:
ChromeDevTools
AChromeextension
ANodemodule
AwebUserInterface(UI)
OnceyousubmitaURLtotheautomatedtool,itwillexecutemultiplepageauditsandcreateareportdetailinghowthepageperforms.Youcanthenusesuggestionsfromtheresultstoimproveyourwebsite.
Lighthouseisnotjustfordevelopers.Thetoolissuitableforanysiteownerinterestedinlearningmoreabouttheirwebsite’sperformanceandconcretestepstooptimizeit.
HowLighthouseAuditsPages
ThemainfocusofLighthouseauditsisGoogle’sCoreWebVitals.Ifyou’reunfamiliar,thesearetheessentialmetricsGoogleusestomeasurewebpages’speedandoverallUserExperience(UX).TheyconsistofLargestContentfulPaint(LCP),FirstInputDelay(FID),andCumulativeLayoutShift(CLS).
Inotherwords,usingLighthousehelpsyouseeyourwebsitethesamewaythatGoogledoes.Youcanusetheactionableinsightsitdeliverstooptimizeyourpagesforbettersearchenginerankingresults.
TheLighthousereportsconsistoffivecategories:
Performance
Accessibility
SEO
Bestpractices
Progressivewebapp
Italsousesa1to100scoringsystemandtestssitesagainstasimulated3Gconnection.However,thescoresmayvaryovertimebecauseGoogleoftenupdatesitsrankingcriteria.Therefore,you’lllikelywanttostayontopofanyLighthouseupdates.
Furthermore,whilesomewhatsimilartoPageSpeedInsights,Lighthouseisnotthesame.Lighthouseoffersamoreholisticpicturethanjustpageperformance(likePageSpeedInsightsdoes).
HowtoUseGoogleLighthouse
Aswementioned,youcanuseahandfulofworkflowsforLighthouse.Ifyoudon’twanttoinstallanextensionorruncommands,youcanutilizeweb.devorDevTools.Below,we’lltakeyouthroughstep-by-stepinstructionsforeachoption.
HowtoRunGoogleLighthouseWithChromeDevTools
Togetstarted,you’llfirstneedtodownloadGoogleChrome(ifyouhaven’talready).Onceinstalled,youcanopenanewbrowsertabinChromeandnavigatetothewebpageyouwanttoaudit.
Next,right-clickonthepageandselectInspect.Youcanalsoclickonthethreeverticaldotsinthetoprightcornerofthebrowser,thennavigatetoMoretools>Developertools.
ThiswillopentheDevToolspaneltotherightortopofthepage.Fromthetoolbar,(1)clickonLighthouse:
Notethatifyoudon’tseetheLighthouseoptioninthetoolbar,youmayneedtoclickonthetwoarrowsattheend.OncetheLighthousetoolopens,ensureallfivecategoriesareselected,then(2)chooseGeneratereport.
OnceLighthousefinishesrunningtheaudit,itwillbringyoutotheresultsscreen.Thatreportwilllooksomethinglikethis:
You’llfindascoreandsectionforeachcategory.Youcanlearnmoreabouteachbyclickingonthescoresatthetopofthepage.
Agoodscoreisconsideredanythingbetween50and89.Anexcellentscoreisbetween90and100.Thegoalistoscoresomewhereinthe90and100rangeforeachcategory.
HowtoUseGoogleLighthouseWithweb.dev
AnotherquickandeasywaytoauditawebpagewithLighthouseisusingweb.dev.Navigatetothispage,thenenterthepageURLyouwanttoaudit:
Next,clickontheRunAuditbutton.Afteraminuteortwo,Lighthousewillfinishanalyzingthesiteandbringyoutothereport.Hereyoucanlearnmoreaboutyourscoreandopportunitiesforimprovementineachcategory:
Youcanclickoneachcollapsedsectiontoexpanditandlearnmore.Youcanalsoaccessdetailedinformationabouteachcategorybyselectingthecategorynameandscoreatthetopofthereport.
HowtoUseGoogleLighthouseWithaChromeExtension
Alternatively,youcandownloadandinstalltheChromeExtensionforLighthouse.ThiscouldbeasolidchoiceifyouplanonusingLighthousefrequently.
Onceagain,you’llneedtohavetheChromebrowserinstalled.Next,youcannavigatetotheChomeWebStoreandinstalltheLighthouseextension:
Aftertheadd-onhasbeeninstalled,restartyourbrowser.Youshouldnowseealighthousesymbolattheendofyouraddressbar.Visitthewebpageyouwanttoaudit,clickonthelighthousesymbol,thenselectGeneratereport:
Thisactionwillbringyoudirectlytothereportpage,whereyoucanviewthegradingdetailsofeachcategory.Notethatitmaytakeaminuteortwofortheaudittocomplete.
HowtoUseGoogleLighthouseviaNode
Ifyou’relookingforconfigurationflexibilitywithLighthouse,youcanalsouseaNodemodule.Thisisamoreadvancedsolution,butitprovidesgreatercontrol.
First,you’llneedtoinstallaLongTermsupportversionofNode:
Next,youcanrunthecommandlinetoinstallLighthouse:
npminstall-glighthouse
#oruseyarn:
#yarnglobaladdlighthouse
Finally,youcanperformtheauditbyusingthefollowingcommand:
lighthouse
延伸文章資訊
- 1Lighthouse | Tools for Web Developers
Lighthouse is an open-source, automated tool for improving the quality of web pages. You can run ...
- 2Lighthouse
Quick-start guide on using Lighthouse: https://developers.google.com/web/tools/lighthouse/ * View...
- 3What Is Google Lighthouse and How to Use It? - Elegant ...
Google Lighthouse is a free, open-source tool that can help you improve your website's speed, per...
- 4GoogleChrome/lighthouse - GitHub
GitHub - GoogleChrome/lighthouse: Automated auditing, performance metrics, ... on Lighthouse, see...
- 5Chrome 推出Lighthouse 前端稽核功能- 為了更好的SEO 與使用 ...
Chrome 開發團隊不斷開發與改進瀏覽和最佳化體驗功能。在Google I/O '17 開發者大會上向外界展示了很多重要的演化,其中一部分是有關Chrome DevTool,因此作為前端開發 ...