CSS Nite in Kobe, vol.43ããŠã§ãããŒãžãé«éåããŠãŠãŒã¶ãŒã«äŸ¡å€ãå±ãããå¶äœè ã®ããã®ã»ãããŒïŒã¯ãŒã¯ã·ã§ãããã«åå ããŠããŸãã
å æ¥éå¬ãããCSS Nite in Kobe, vol.43ããŠã§ãããŒãžãé«éåããŠãŠãŒã¶ãŒã«äŸ¡å€ãå±ãããå¶äœè ã®ããã®ã»ãããŒïŒã¯ãŒã¯ã·ã§ãããã«åå ããŠããŸããã
ä»åã®ç»å£è
ä»åã®ç»å£è ã¯æ ªåŒäŒç€Ÿãµã€ããŒãšãŒãžã§ã³ãã®äœè€ æ©ããã§ãã
ãè¶ éïŒWebããŒãžé床æ¹åã¬ã€ãããšããæžç±ã®èè ã§ããããããã©ãŒãã³ã¹ãšã¢ã¯ã»ã·ããªãã£ã軞ãšãããWebãããã¯ãå質åäžã®ãããã§ãã·ã§ãã«ãªæ¹ã§ãã
ã»ãããŒå šäœãéããŠã®ææ³
ããŒãžã®è¡šç€ºé床ãéèŠã ãšèšãããŠããã®ã¯ããèããŸããããããã©ããã£ãŠè¡šç€ºé床ãäžããŠããã®ãã¯ããŸãèããããšããããŸãããã衚瀺é床é«éåã«ãã©ãŒã«ã¹ããã»ãããŒãããŸãç¡ãããã«æããŸãã
ã©ããªã«è¯ãã³ã³ãã³ããäœã£ãŠãã衚瀺ãé
ããŠèŠãããªãã®ã§ã¯æå³ããããŸããã
ãã®ããã«å¿
èŠãªç¥èãããŠããŠããåŸãããŸããã
ç¹ã«å°è±¡æ·±ãã£ãã®ããã¯ãŒã¯ã·ã§ããã®ãšãã«äœè€ããããé床ã3Gåç·ãŸã§èœãšããŠãªããŒãããŠãã³ã³ãã³ããã©ã®é çªã§èªã¿èŸŒãŸãããšãŠãŒã¶ãŒäœéšãè¯ããªããèãããšããããšä»°ã£ãŠããããšã§ãã
ããŒãžã®é床æ¹åãšãããšãå šãŠæ°åãèŠãŠå€æããŠãããããªã€ã¡ãŒãžãæã£ãŠããŸããããçµå±ã¯WebããŒãžãªã®ã§ãå®éã«ãã®ããŒãžãèŠã人ã®æ°æã¡ã«ãªããªããã°æå³ããããŸããã
ãã¡ããæ°åãææšãšããŠéèŠã§ããããããšã¯ãŸãå¥ã®èŠç¹ãåŸãããã®ã¯å€§ããã£ãã§ãã
ãŠã§ãããŒãžã®é«éåæ¹æ³
WebããŒãžã®é床ã«ã¯2çš®é¡ãããŸãããä»åã¯ããŒãžããŒãæã®é«éåã«ã€ããŠã®å 容ã§ããã
- ããŒãžããŒãïŒãã©ãŠã¶ãããŒãžãæåã«è¡šç€ºããé床ïŒäžè¬çã«è¡šç€ºé床ãšèããŠæãæµ®ãã¹ãæ¹ïŒ
- First Contentful PaintïŒFCPïŒïŒåããŠã³ã³ãã³ãã衚瀺ãããæé
- First Input DelayïŒFIDïŒïŒãŠãŒã¶ãŒã®æäœã«å¯ŸããŠã®æåã®å¿çæé
- Time to InteractiveïŒTTIïŒïŒããŒãžã®è¡šç€ºãçµãããå®å šã«æäœå¯èœã«ãªã£ãæé
- ã©ã³ã¿ã€ã ïŒãã©ãŠã¶ã衚瀺ãã³ã³ãã³ããåããé床ïŒCanvasãã¢ãã¡ãŒã·ã§ã³ããŽãªãŽãªäœ¿ã£ãŠããªããã°ç¹ã«åé¡ãªãïŒ
ãŸããããŒãžããŒãã«ãããã€ãã®ãã§ãŒãºããããŸãã
ãšããããLighthouseã確èªããã®ãæã£åãæ©ã
ããŸã¯LighthouseãšããGoogleãåºããŠãã確èªãµãŒãã¹ãå©çšããã°OKã ããã§ãã
䜿ãæ¹ã¯Google Chromeã®éçºè ããŒã«ã§ãAuditsãã¿ããéããŠããRun auditsããã¯ãªãã¯ããã°Lighthouseãèµ·åããŸãã
èµ·åããåã«ããã€ãé ç®ãèšå®ããããšã§ãèšå®ã§ããŸãã
èšå®é ç® | éžæè¢ | åè |
---|---|---|
Device | ãMobileïŒã¹ããïŒããšãDesktopïŒPCïŒãã©ã¡ãã§ç¢ºèªãããéžæ | |
Audits | æ€æ»ããé ç®ãéžæ | |
Throttling | ãSimulated Fast 3G, 4x CPU Slowdownã â3Gåç·ãåŠçé床ã4åã®1ã®å Žåãæšå®ããŠæ€æ»ãã ãApplied Fast 3G, 4x CPU Slowdownã â3Gåç·ãåŠçé床ã4åã®1ã«ããŠæ€æ»ãã ãNo throttlingã âäœããããã®ãŸãŸæ€æ»ãã | ãSimulatedãã¯ãããŸã§æšå®ã ãAppliedãã®å Žåã¯å®éã«ãããã¯ãŒã¯ã CPUã®ã¹ããããªã³ã°ãè¡ãã |
Clear storage | ã¹ãã¬ãŒãžãã¯ãªã¢ããŠæ€æ»ãã | ååã¢ã¯ã»ã¹æãæ³å®ããããã«ããã§ãã¯ãå ¥ããŠãã |
åç·ãé
ãããŠãã¹ãã§ããã®ãç¹åŸŽçã§ãããã
ããã§ã¹ã³ã¢ãé«ããšããŠãŒã¶ãŒã«ãšã£ãŠãéãå¯èœæ§ãé«ããªããŸãã
ãã®ããã°ã®ãããããŒãžã§ãè¡ãªã£ãŠã¿ãŸãããããSimulated Fast 3G, 4x CPU Slowdownãã ãš98ç¹ãšãããªãè¯ãçµæã§ããïŒAccessibilityãšBest Practicesã®ç¹ãã€ãã€ãã§ãã…ïŒã
ã¡ãªã¿ã«ãNo throttlingãã®æ¹ãè©Šããš100ç¹ã«ãªããŸããã
é床å¶éãè¡ãªã£ãŠããªãå Žåã§100ç¹ãåã£ãŠããé床å¶éããã人ãããããš98ç¹ãšå°ãã¹ã³ã¢ãèœã¡ãããšãåãããŸãã
ä»ã®ãã¹ããµãŒãã¹ãšæ¯èŒ
ä»ã«ãæåãªãŠã§ããµã€ãã®ãã¹ããµãŒãã¹ã§ãããPageSpeed InsightsãããWebPageTestãã§ãè©ŠããŠã¿ãŸããã
PageSpeed Insightsã®ããŒãžé床ã«é¢ããéšåã¯ãLighthouseã䜿ãããŠãããšã®ããšã§ãããã ãåç·ãé ããããã¯ã§ããªããããLighthouseã®ãNo throttlingããšåã100ç¹ãåºãŸããã
WebPageTestã®æ¹ã«é¢ããŠã¯ãã¢ã«ãã¡ãããè©äŸ¡ã§å šãŠAã«ãªã£ãŠããŸããã
ãã®ããšãããããšããããLighthouseã1çªçŽ°ãããšãããŸã§èŠãããã§ãããç¹æ°ãã·ãã¢ã§ãLighthouseã®ç¹æ°ãäžããã°èªç¶ãšä»ã®ãã¹ããµãŒãã¹ã§ã奜æ瞟ãåºããããã«ãªãããã§ãã
ããŒãžããŒããé ãããåå
- HTMLã®è¿åŽãé
ã
- ãµãŒããŒåŽã®HTMLçæãäœãšãããïŒéçãµã€ãã®åŒ·ã¿ã¯ãã®éšåããªãããšïŒ
- ãã£ãã·ã¥ç³»ã®ãã©ã°ã€ã³ã䜿ã
- ãµãŒããŒã®æ§èœãäžãã
- ãµãŒããŒãç©ççã«è¿ã¥ããïŒåœå ã®ã¬ã³ã¿ã«ãµãŒããŒãªãæ°ã«ããªããŠè¯ãïŒ
- ç»åã倧ããã»å€ãïŒ1çªåœ±é¿å€§ããïŒ
- ç»åã®åœ¢åŒãèŠçŽã
- ç»åã®å質ãèŠçŽã
- ã¡ã¿ããŒã¿é€å»ãªã©æé©ååŠçããã
- ç»åã®é 延èªã¿èŸŒã¿ãè¡ã
- ãã£ãã·ã¥ãå§çž®ãæå¹ã§ãªã
- ãã©ãŠã¶ãã£ãã·ã¥ãèšå®ãã
- gzipãé©çšãã
- ãã£ãã·ã¥ãå§çž®ããµãŒããŒïŒããã«ãŠã§ã¢ïŒã§èšå®ã§ãã
- CSSãJavaScriptã倧ãããã
- CSSã¯1ãã¡ã€ã«ã«çµåããããåããæ¹ãè¯ã
- jQueryãã©ã°ã€ã³ãèŠçŽãïŒå€æ©èœãªãã®ã¯å®¹éã倧ããã®ã§ãè¿œå æã«ã¯ã·ã³ãã«ãªãã®ãéžã¶ïŒ
- npmã§ã®äŸåããã±ãŒãžãèŠçŽã
- ã¬ã³ããªã³ã°ããããã¯ãããŠãã
<script>
ã¯</body>
ã®çŽåãžé 眮<script>
ã«deferå±æ§ãã€ãã- Web Fontsããªãã¹ã䜿ããªãããã«ãã
- åºåãSNSç³»ãã©ã°ã€ã³ãå€ã
- ãªãã¹ãæžãã
- åºåã«é¢ããŠã¯ã©ããããããªãéšåãããããSNSç³»ã®ãã®ã¯æ¬åœã«å¿ èŠãæ€èšãã
å人çã«æ°ã«ãªã£ãã®ããCSSã¯1ãã¡ã€ã«ã«çµåããããåããæ¹ãè¯ãããšããéšåã
æè¿ã¯Sassã®@importã䜿ã£ãŠãè€æ°ã®Sassãã¡ã€ã«ã1ã€ã«ãŸãšããŠæžãåºããŠããã®ã§ãããåå²ããæ¹ãè¯ãã£ããã§ããã
æã¯HTTP/1.1ãšããéä¿¡ãäž»æµã§ã1ãµãŒããŒãããåæã«ããŠã³ããŒãã§ãããã¡ã€ã«ã®æ°ã6åãŸã§ã ã£ãã®ã§ãCSSãã¡ã€ã«ã1ã€ã«ããŠãã¡ã€ã«æ°ãæžãããŠããã¿ããã§ãã
ä»ã¯HTTP/2ãšããéä¿¡ãäž»æµã§ã18åãŸãšããŠäžŠåããŠã³ããŒãã§ããããã«ãªã£ãããããCSSãã¡ã€ã«ãåå²ãããŠããŠãåé¡ãªãã¿ããã§ãã
ãŸãšã
ããªãçŸå®çã§æ¬¡ã®æ¥ãããã䜿ãããããªç¥èãããããåŸãããŸããã
ãšãããããäžèšã®3é ç®ã¯æ¯èŒçã©ã€ãã«å§ããããããªã®ã§ãæ¥é ããæèããŠãããããšæããŸãã
- ãŸãã¯Lighthouseã確èªãã
- ç»åã¯æåã«äœæãã段éã§æ¡åŒµåãé©åã«ããŠãå§çž®ãããŠãã
- ãã©ã°ã€ã³ãããã±ãŒãžãå°å ¥ãããšãã¯ãµã€ãºãæèãã