å°è¥¿ç§åã§ãã
ç¾å¨ãAWSã®éçã¦ã§ããµã¤ããã¹ãã£ã³ã°ã§å
¥éããAWS Amplify(ConsoleãCLI) ï¼ æ¦è¦ç·¨ãªã©AWSã®ãµã¼ãã¼ã¬ã¹ãªéçã¦ã§ããµã¤ããã¹ãã£ã³ã°ããã¼ãã«ããããã°è¨äºãå·çãã¦ãã¾ãã
ä»åãAWSã¯é¢ä¿ãã¾ãããããã³ãã¨ã³ãã«è¿ã話é¡ã§ãæè¿ååãæ¬æ ¼çã«ãªã£ã¦ããã¨æãã¦ããPWA(Progressive Web Apps)ã«ã¤ãã¦ç§ãèªä¸»çã«å¦ç¿ããå
容ãè¨äºã«ãã¦ã¿ã¾ããã
ç§ã®å ´åã¯Amazon S3ãAmazon CloudFrontãAWS Certificate ManagerãAmazon Route53ã使ç¨ããéçã¦ã§ããµã¤ãã«æå°éã®ã³ã³ãã³ãããããã¤ãã¦PWAã®å®è£
ã«ã¤ãã¦å¦ç¿ãã¾ããã
ã¾ããLighthouse Report Viewerã¨ããPWAãªã©ã®å質ãã¹ããã§ãããã¼ã«ã使ç¨ãã¦ãPWAã®åºæºã«åæ ¼ããPerformanceãAccessibilityãBest PracticesãSEOã¨ãã£ãã«ãã´ãªã§ãä½åãã«1å100ç¹ãåããç¶æ
ã¾ã§å¯¾çããã¦ã¿ã¾ããã
以éã§ã¯ãPWAã®æ¦è¦ã¨å©ç¹ãAWSã使ãçç±ãPWAã«å¯¾å¿ããããã«å®è£
ããæä½éã®ãã¨ãLighthouse Report Viewerã®ä½¿ãæ¹ãLighthouseã§é«å¾ç¹ãåºãããã«é
æ
®ãããã¨ã«ã¤ãã¦ä¸»ã«è¨è¼ãã¦ãã¾ãã
â»æ¬è¨äºããã³å½å·çè
ã®ãã®ä»ã®è¨äºã§æ²è¼ããã¦ããã½ã¼ã¹ã³ã¼ãã¯èªä¸»ç 究活åã®ä¸è²«ã¨ãã¦ä½æãããã®ã§ãããåä½ãä¿è¨¼ãããã®ã§ã¯ããã¾ããã使ç¨ããå ´åã¯èªå·±è²¬ä»»ã§ãé¡ãè´ãã¾ããã¾ããäºåãªãä¿®æ£ãããã¨ãããã¾ãã®ã§ãäºæ¿ãã ããã
PWA(Progressive Web Apps)ã¨ã¯
PWA(Progressive Web Apps)ã¨ã¯ä¸è¨ã§ããã¨ãã©ã¦ã¶ã§è¡¨ç¤ºãããã¦ã§ããµã¤ãããã¤ãã£ãã¢ããª(iOSã¢ããªãAndroidã¢ããªãªã©)ã®ããã«ä½¿ç¨ã§ããããã«ããä»çµã¿ã§ãã
ã¦ã§ããµã¤ããPWAã«å¯¾å¿ãããã¨ãPWAããµãã¼ããã¦ãããã©ã¦ã¶ã使ç¨ã§ããOS(iOSãAndroidãWindowsãmacOSãªã©)ã«ã¦ã§ããµã¤ããã¢ããªã®ãããªå½¢å¼ã§è¿½å ã§ãã¾ãã
PWA対å¿ããã¦ã§ããµã¤ãã¯PWAã¨ãã¦ã®ã¿åä½ããããã§ã¯ãªããä»ã¾ã§éããã©ã¦ã¶ã§åç
§ããé常ã®ã¦ã§ããµã¤ãã¨ãã¦ãåä½ãã¾ãã
ä¾ãã°PWAããµãã¼ããã¦ããAndroidã®Chromeã®å ´åãPWA対å¿ã¦ã§ããµã¤ãã表示ãã¦ãªãã·ã§ã³ã¡ãã¥ã¼ã®ãã¢ããªãã¤ã³ã¹ãã¼ã«ãããã¦ã§ããµã¤ããã¢ããªã¨ãã¦è¿½å ãããã¨ãã§ããããã·ã¥éç¥ãåãåããã¨ãã§ãã¾ãã
ã¾ããææ°ã®iOSãã¤ã³ã¹ãã¼ã«ãã¦ããiPhoneã§ããSafariã§PWA対å¿ã¦ã§ããµã¤ãã表示ãã¦ãªãã·ã§ã³ã¡ãã¥ã¼ã®ããã¼ã ç»é¢ã«è¿½å ãããã¦ã§ããµã¤ããã¢ããªã¨ãã¦è¿½å ãã¦ã¹ã¿ã³ãã¢ãã³ã§ç«ã¡ä¸ãããã¨ã¯å¯è½ã§ãã
ããã«ãæè¿ã§ã¯Windows10ã»11ãmacOSãªã©ã®ææ°OSãã¤ã³ã¹ãã¼ã«ããPCã§ãPWA対å¿ãããã©ã¦ã¶ã使ç¨ããã°PWA対å¿ã¦ã§ããµã¤ããã¢ããªã®ãããªã¤ã³ã¿ãã§ã¼ã¹ã§ä½¿ç¨ã§ããããã«ãªã£ã¦ãã¦ãã¾ãã
Google Chromeã§PWAãã¤ã³ã¹ãã¼ã«ããæ¹æ³ã«ã¤ãã¦ã¯æ¬¡ã®åèè³æãåç
§ãã¦ãã ããã
PWAã¤ã³ã¹ãã¼ã«åèè³æï¼ããã°ã¬ãã·ã ã¦ã§ãã¢ããªãå©ç¨ãã - ãã½ã³ã³ - Google Chrome ãã«ã
ãã ãæ¬è¨äºå·çæç¹ã§ã¯åOSããã©ã¦ã¶ã§PWAã®ãµãã¼ãå
容ã¯ããªãå·®ããããããå®ç¾ãããã¨ãã¦ããè¦ä»¶ãæºãããã©ããã¯ãã®é½åº¦ãç¶æ³ã調æ»ããå¿
è¦ãããã¾ãã
PWAã«å¯¾å¿ãããå©ç¹
ç§ã¯PWAã¯ã¦ã§ããµã¤ãã¨ã¢ãã¤ã«ãã¤ãã£ãã¢ããªã®éã«ä½ç½®ã¥ããããã®ã§ã¯ãªããã¨èãã¦ãã¾ãã
ããã§ãç§ãæããã¦ã§ããµã¤ããPWAã«å¯¾å¿ãããå©ç¹ãã¢ãã¤ã«ãã¤ãã£ãã¢ããªããè¦ãPWAã®å©ç¹ãåèã¨ãã¦æãã¦ã¿ã¾ãã
ã¦ã§ããµã¤ããPWAã«å¯¾å¿ãããå©ç¹ã«ã¯æ¬¡ã®ãããªãã®ãæãããã¾ãã
- ã¢ããªã®ããã«ã¢ã¤ã³ã³ãOSã®ç»é¢ã«è¿½å ã§ãã
- ãã©ã¦ã¶ã§ã¯ãªãã¹ã¿ã³ãã¢ãã³ã®ä¸ã¤ã®ã¢ããªã¨ãã¦ã¦ã§ããµã¤ãã使ç¨ã§ãã
- ãã¼ã«ã«ãã£ãã·ã¥ããã³ã³ãã³ããè¨å®ããã°ãªãã©ã¤ã³ã§ãèµ·åã§ãã
- OSããã©ã¦ã¶ã§ãµãã¼ãããã¦ããã°ããã·ã¥éç¥ã使ç¨ã§ãã
ä¸æ¹ã§ã¢ãã¤ã«ãã¤ãã£ãã¢ããªããè¦ãPWAã®å©ç¹ã«ã¯æ¬¡ã®ãããªãã®ãæãããã¾ãã
- éçºè¨èªãå ±éåã§ããOSã¸ã®ä¾åæ§ãå°ãªãã§ãã
- ããã³ãã¨ã³ãããããã¯ã¨ã³ãã¾ã§ã¦ã§ããµã¤ãããæä¾ã§ãã
âã¢ããªã¹ãã¢ã«ç»é²ãã¦ä¸»è¦ãªæ©è½ãã¾ã¨ãã¦ãã¦ã³ãã¼ãããã¤ã³ã¹ãã¼ã«ãã¢ãããã¼ãããå¿ è¦ããªã
âãã£ãã·ã¥ãç ´æ£ããã°å¸¸ã«ææ°ãã¼ã¸ã§ã³ã®æ©è½ãã¦ã§ããµã¤ãããæä¾ã§ãã
PWAã®å®è£ ç°å¢ã«AWSã使ãçç±
PWAã¯åºæ¬çã«éçã³ã³ãã³ãããã¹ãã£ã³ã°ã§ããPWAãåä½ã§ããã®ã§ããã°ã¦ã§ããµã¼ãã¼ã®ç¨®é¡ã¯ç¹ã«åããã¾ããã
ããã§ãç§ãPWAã®å®è£
ç°å¢ã«AWSã®Amazon S3ãAmazon CloudFrontãAWS Certificate ManagerãAmazon Route53ã®çµã¿åããã使ãçç±ãããã¤ãç´¹ä»ãã¾ãã
- Amazon S3ã®é«å¯ç¨æ§ã¹ãã¬ã¼ã¸
1å¹´éã«99.999999999%ã®å ç¢æ§ã¨99.99%ã®å¯ç¨æ§ãæä¾ããããè¨è¨ãããã¹ãã¬ã¼ã¸ã§é ä¿¡ããã³ã³ãã³ããä¿åã§ããã - Amazon CloudFrontã®ã°ãã¼ãã«ãªã¨ãã¸ãã±ã¼ã·ã§ã³ã¨ãã£ãã·ã¥æ©è½
ã°ãã¼ãã«ã«é ç½®ãããã¨ãã¸ãã±ã¼ã·ã§ã³ãããã£ãã·ã¥ãå©ç¨ããã³ã³ãã³ããé ä¿¡ãããããæ§ã ãªå°åããã®ã¦ã§ããµã¤ã表示ã®é度åä¸ãæå¾ ã§ããã - AWS Certificate Managerã®ããã¼ã¸ãåç¡æãããªãã¯è¨¼ææ¸
æ´æ°ç®¡çä¸è¦ã§ç¡æã®SSL/TLS証ææ¸ãã«ã¹ã¿ã ãã¡ã¤ã³ã«å¯¾ãã¦çºè¡ããAmazon CloudFrontãªã©ã®AWSãµã¼ãã¹ã«é¢é£ä»ãããã¨ãã§ããã - Amazon Route53ã®å¤æ©è½æ§
ãã¡ã¤ã³ã®Zone Apexã«å¯¾ãã¦Amazon CloudFrontãã¬ã³ã¼ãç»é²ãããã¨ãã§ãããã«ã¹ãã§ãã¯ãã«ã¼ãã£ã³ã°ãªã©ã®æ©è½ãå å®ãã¦ããã - AWS Amplify Consoleã§S3ï¼CloudFrontï¼Certificate Managerï¼Route53ã®çµã¿åãããè¿
éã«æ§ç¯å¯è½
ä¸è¨ã®AWSãµã¼ãã¹ãåå¥ã«è¨å®ããä½æ¥ãçç¥ãããå ´åã¯AWS Amplify Consoleã使ç¨ãããã¨ã§ãã©ã¦ã¶ãããããã®çµã¿åããã容æã«ä½æã§ããã
â»AWS Amplify Consoleã®ä½¿ç¨æ¹æ³ã«ã¤ãã¦ã¯æ¬¡ã®è¨äºãåç §ãã¦ãã ããã
AWSã®éçã¦ã§ããµã¤ããã¹ãã£ã³ã°ã§å ¥éããAWS Amplify(ConsoleãCLI) ï¼ æ§ç¯ç·¨(Amplify Console) - ã³ã¹ãæé©å
AWSãµã¼ãã¹ã¯ã³ã³ãã³ãã®ä¿åéããªã¯ã¨ã¹ãéãªã©ä½¿ç¨ããéã«å¯¾ããå¾é課éå¶ã§ãä¸è¨ã®AWSãµã¼ãã¹ã®çµã¿åããã®å ´åã¯ä»®æ³ãµã¼ãã¼ã®èµ·åã³ã¹ããçºçããªããããæ¯è¼çå®ä¾¡ã«éç¨ã§ããã
ç¹ã«ã³ã³ãã³ãéããªã¯ã¨ã¹ãéãæ¯è¼çå°ãªãä»åã®ä¾ã®ãããªã¦ã§ããµã¤ãã§ããã°ãæ°ç¾å/æã§ãããã®é«æ©è½ã使ç¨å¯è½ã - ã¦ã§ããµã¤ãã«æ©è½è¿½å ããé¸æè¢ãè±å¯
æå°éã®ã³ã³ãã³ãã§ç¨æããã¦ã§ããµã¤ããæ¡å¼µãã¦æ©è½è¿½å ãããå ´åã§ãAWSã«ã¯ä¸è¨ã®ãµã¼ãã¹ã¨è¦ªåæ§ã®é«ãæ§ã ãªããã¯ã¨ã³ããæ§ç¯ããããã®ãµã¼ãã¹ãããã - ã¦ã§ããµã¤ãã«æ©è½è¿½å ãããå ´åã®æè¡è³æãè±å¯
AWSããæä¾ãããããã¥ã¡ã³ãããµãã¼ãã«å ãã¦ãAWSã¨ã³ã¸ãã¢ããã®ã³ãã¥ããã£ã®ã¢ã¦ãããããªã©ãAWSã¯ãµã¼ãã¹æ´»ç¨ã®ãã³ããå¾ãããæ å ±æºãè±å¯ã
ãã®ãã¡ãç¹ã«Amazon CloudFrontã¯åå°ã®ã¨ãã¸ãã±ã¼ã·ã§ã³ããã³ã³ãã³ããé
ä¿¡ãããããå¾è¿°ããLighthouse Report Viewerã®Performanceã«ãã´ãªã«è©²å½ããã¦ã§ããµã¤ã表示æéã®ç縮ã«å¹æçã ã¨èãããã¾ãã
Amazon CloudFrontã¯ããã¯ã¨ã³ãã«AWS以å¤ã®ãµã¼ãã¼ãæå®ãããã¨ãã§ããããããã¼ã¸è¡¨ç¤ºé度ã®æ¹åçã¨ãã¦Amazon CloudFrontã試ãã¦ã¿ãã¨ãããã¨ãä¸ã¤ã®é¸æè¢ã§ãããã
PWAã«å¯¾å¿ããããã«å®è£ ããæä½éã®ãã¨
ããããã¯ã¦ã§ããµã¤ããPWAã«å¯¾å¿ããããã«å®è£
ãããã¨ãä¾ã¨ãã¦ç´¹ä»ãã¾ãã
ä»åã¯èªä¸»å¦ç¿ã®ç¯å²ã§PWAã®å®è£
æ¹æ³ã¨Lighthouse Report Viewerã§ã®ãã§ãã¯ã«åæ ¼ãããã¨ãç®çãªã®ã§ã対象ã¨ããã¦ã§ããµã¤ãã®ã¡ã¤ã³ã³ã³ãã³ãã¯index.htmlã¨æå°éã®ç»åã®ã¿ã§æ§æãã¾ããã
ãã以å¤ã®ã³ã³ãã³ãã¯ä¸»ã«PWA対å¿ã«å¿
è¦ãªJavaScriptã¨AndroidãiOSãªã©ã®åOSã¸ã®ã¢ããªè¿½å ã§å¿
è¦ã¨ãªãã¢ã¤ã³ã³ç»åãä¸å¿ã§ãã
ã¦ã§ããµã¤ãã«ãããã¤ããPWAé¢é£ãã¡ã¤ã«ä¸è¦§
ä»åãPWA対å¿ã試ãã¦ã§ããµã¤ãã®ã«ã¼ããã£ã¬ã¯ããªããè¦ãPWAé¢é£ã®ãã¡ã¤ã«ã®ä¸è¦§ã次ã«æ²è¼ãã¾ãã
ã»ã¨ãã©åOSç¨ã®ãµã¤ãºãç¨éå¥ã®ã¢ã¤ã³ã³ç»åã§ãããmanifest.jsonã¨sw.jsã¨ããã®ãPWAãå®ç¾ããä¸å¿çãªå½¹å²ãæããã¾ãã
ä»åã¯å端æ«ãåOSãã¢ã¤ã³ã³ã§æ¡ç¨ãããµã¤ãºãæ·±ã調æ»ããããã§ã¯ãªãã®ã§ãããã ãããã°è©²å½ããç»åãµã¤ãºãããã ããã¨ç¨®é¡ãå¤ãã«ç¨æãã¦ãã¾ãã
ã¾ããå¦ç¿ç®çã§æ§ãã©ã¦ã¶ãæ§OSã«å¯¾å¿ããããã®è¨è¿°ãæ®ãã¦ããã®ã§ç¡é§ãªãã®ãããã¨æãã¾ãã
ãã®ããããã®ç¹ã®èª¿æ»ãã§ãã¦ã¿ã¼ã²ããã¨ãªãOSããã©ã¦ã¶ã決ã¾ã£ã¦ããã°ãå®éã¯ããã¾ã§ç´°ãããµã¤ãºå¥ã®ç»åãç¨æãã¦ããå¿
è¦ã¯ãªãã§ãããã
åãã¡ã¤ã«ã®èª¬æã«ã¤ãã¦ã¯å¾è¿°ãã¾ãã
[ho2k_com@ho2k-com hidekazu-konishi.com]$ tree . âââ ï½ä¸è¦é¨åã¯çç¥ããè¦ãããããã«é çªå¤æ´ãã¦ãã¾ãï½ âââ android-chrome-36x36.png âââ android-chrome-48x48.png âââ android-chrome-72x72.png âââ android-chrome-96x96.png âââ android-chrome-128x128.png âââ android-chrome-144x144.png âââ android-chrome-152x152.png âââ android-chrome-192x192.png âââ android-chrome-256x256.png âââ android-chrome-384x384.png âââ android-chrome-512x512.png âââ android-chrome-maskable-48x48.png âââ android-chrome-maskable-72x72.png âââ android-chrome-maskable-96x96.png âââ android-chrome-maskable-128x128.png âââ android-chrome-maskable-192x192.png âââ android-chrome-maskable-384x384.png âââ android-chrome-maskable-512x512.png âââ apple-touch-icon-57x57-precomposed.png âââ apple-touch-icon-57x57.png âââ apple-touch-icon-60x60-precomposed.png âââ apple-touch-icon-60x60.png âââ apple-touch-icon-72x72-precomposed.png âââ apple-touch-icon-72x72.png âââ apple-touch-icon-76x76-precomposed.png âââ apple-touch-icon-76x76.png âââ apple-touch-icon-114x114-precomposed.png âââ apple-touch-icon-114x114.png âââ apple-touch-icon-120x120-precomposed.png âââ apple-touch-icon-120x120.png âââ apple-touch-icon-144x144-precomposed.png âââ apple-touch-icon-144x144.png âââ apple-touch-icon-152x152-precomposed.png âââ apple-touch-icon-152x152.png âââ apple-touch-icon-180x180-precomposed.png âââ apple-touch-icon-180x180.png âââ icon-16x16.png âââ icon-24x24.png âââ icon-32x32.png âââ icon-36x36.png âââ icon-48x48.png âââ icon-72x72.png âââ icon-96x96.png âââ icon-128x128.png âââ icon-144x144.png âââ icon-152x152.png âââ icon-160x160.png âââ icon-192x192.png âââ icon-196x196.png âââ icon-256x256.png âââ icon-384x384.png âââ icon-512x512.png âââ favicon.ico âââ index.html âââ index.js âââ manifest.json âââ sw.js
åãã¡ã¤ã«èª¬æï¼android-chrome-âxâ.png
é¢é£ãã¡ã¤ã«ä¸è¦§ã®ãã¡android-chrome-âxâ.pngã®ãã¡ã¤ã«åå½¢å¼ã®ãã®ã¯ä¸»ã«Androidã¨Chromeåãã®ã¢ã¤ã³ã³ã¨ãã¦ä½æãã¾ããã
Androidã¨Chromeã¯PWAãç©æ¥µçã«æ¨é²ãã¦ããGoogleã®ãããã¯ãã§ãããããPWAã®è¨å®ã§ãç´°ããã¢ã¤ã³ã³è¨å®ãå¿
è¦ã§ãã
PWAã®è¨å®ãã¡ã¤ã«ã«ç¸å½ããmanifest.jsonã§ã¯android-chrome-âxâ.pngã次ã§èª¬æããandroid-chrome-maskable-âxâ.pngã¨ãã£ãAndroidã¨Chromeåãã®ãµã¤ãºå¥ã¢ã¤ã³ã³ç»åãæå®ããã»ããããã§ããã(å¾è¿°ã®Lighthouse Report Viewerã®PWAåºæºã®ã¯ãªã¢ã«ãå¿
è¦ã§ã)ã
åãã¡ã¤ã«èª¬æï¼android-chrome-maskable-âxâ.png
é¢é£ãã¡ã¤ã«ä¸è¦§ã®ãã¡android-chrome-maskable-âxâ.pngã®ãã¡ã¤ã«åå½¢å¼ã主ã«Androidã¨Chromeåãã®ã¢ã¤ã³ã³ã§ãããandroid-chrome-âxâ.pngã¨ã¯ç¨éãç°ãªãã¾ãã
android-chrome-maskable-âxâ.pngã¯ãPWAã®maskable iconã«å¯¾å¿ããç»åã§ãã
maskable iconã¨ã¯ã»ã¼ãã¾ã¼ã³ã¨ããåå½¢é åã«ãã¶ã¤ã³ãåã¾ãã¢ã¤ã³ã³ç»åã®ãã¨ã§ãã
ã»ã¼ãã¾ã¼ã³ã¨ã¯æ£æ¹å½¢ã®ç»åã®ä¸è¾ºã100%ã¨ããã¨ãã«ãæ£æ¹å½¢ã®ä¸å¿ãã40%ãåå¾ã¨ããåã®é åãæãã¾ãã
ã»ã¼ãã¾ã¼ã³åèè³æï¼W3C - Web Application Manifest - Icon masks and safe zone
ã¤ã¾ãããã®ã»ã¼ãã¾ã¼ã³å
ã«ãã¶ã¤ã³ãåã¾ãã¢ã¤ã³ã³ç»åãåãµã¤ãºå¥ã«ä½æãããã®ããä»åã®ä¾ã¨ãã¦æãã¦ããandroid-chrome-maskable-âxâ.pngã§ãã
maskable iconã®ä½æã¯ãã¦ãã¦ãªãã«èªä½ããã¨çµæ§å¤§å¤ã§ãã®ã§ã次ã®ãMaskableâ.appãã¨ãããµã¤ãã§ä½æããã¨ç°¡åã§ãã
â maskable iconä½ææé
- https://maskable.app/editorã«ãã©ã¦ã¶ã§é·ç§»ãã
- å³ä¸ã®ãLayersãã®ãUploadããã対象ç»åãã¢ãããã¼ããã
- ã¢ãããã¼ãç»åã表示ãããç»é¢ä¸å¤®ä¸ã®ãMasksãã§ãMinimum safe areaããé¸æãã
- å³å´ã®ãµã¤ãã¡ãã¥ã¼ã§Paddingãèæ¯è²ãªã©ã調æ´ãã¦é åã«ãã¶ã¤ã³ãåã¾ãããã«èª¿æ´ãã
- ã¢ãããã¼ãç»åã表示ãããç»é¢ä¸å¤®ä¸ã®ãExportãããä½æããç»åããµã¤ãºãæå®ãã¦ãã¦ã³ãã¼ãããã
åãã¡ã¤ã«èª¬æï¼apple-touch-icon-âxâ.png
é¢é£ãã¡ã¤ã«ä¸è¦§ã®ãã¡apple-touch-icon-âxâ.pngã®ãã¡ã¤ã«åå½¢å¼ã®ãã®ä¸»ã«iPhoneãiPadãªã©ã®Apple製ååãã®ã¢ã¤ã³ã³ç»åã§ãã
ã¦ã§ããµã¤ããããã¼ã ç»é¢ã«è¿½å ããããå ´åã®ã¢ã¤ã³ã³ç»åã¨ãã¦ä½¿ç¨ããã¾ãã
åãã¡ã¤ã«èª¬æï¼apple-touch-icon-âxâ-precomposed.png
é¢é£ãã¡ã¤ã«ä¸è¦§ã®ãã¡apple-touch-icon-âxâ-precomposed.pngã®ãã¡ã¤ã«åå½¢å¼ã®ãã®ã¯å¤ãiOSã§ã¢ã¤ã³ã³ã«å
æ²¢å¦çãããªãç»åãæå®ãããã®ã§ãã
ç¾å¨ã§ã¯åºæ¬çã«ä¸è¦ã§ãããä»åã¯å¦ç¿ç®çãªã®ã§ãã®ãããªä»æ§ããã£ããã¨ãè¨é²ã¨ãã¦æ®ãããã«è¨è¼ãã¦ãã¾ãã
åãã¡ã¤ã«èª¬æï¼icon-âxâ.png
ä¸è¨ã®ã¢ã¤ã³ã³ä»¥å¤ã使ç¨ããOSããã©ã¦ã¶ãªã©ã«æ±ç¨çã«å¯¾å¿ããããã®ã¢ã¤ã³ã³ç»åã§ãã
åãã¡ã¤ã«èª¬æï¼favicon.ico
favicon.icoã¯å¾æ¥ãã使ç¨ããã¦ãããã©ã¦ã¶åãã®ã¢ã¤ã³ã³ç»åã§ãã
favicon.icoã¯åè¿°ã®icon-48x48.pngï½icon-192x192.pngã¾ã§ã®8種é¡ã®ãµã¤ãºãã¾ã¨ãã¦ãã«ãã¢ã¤ã³ã³ã«ãã¦ãã¾ãã
åãã¡ã¤ã«èª¬æï¼manifest.json
manifest.jsonã¯PWAãå°å
¥ããå ´åã«å¿
é ã¨ãªãã¢ããªè¨å®ã®å½¹å²ããããã¡ã¤ã«ã§ãã
ããã§ã¯ä»åã®ä¾ã§ä½¿ç¨ããmanifest.jsonããã¼ã¹ã«èª¬æãã¦ããã¾ãã
ãã®ä»ãmanifest.jsonã®è©³ç´°ã«ã¤ãã¦ã¯æ¬¡ã®åèè³æãåç
§ãã¦ãã ããã
manifest.jsonåèè³æï¼W3C - Web Application Manifest - Web Application Manifest
ã¾ããä»åã®ä¾ã§ä½¿ç¨ããåãã¼ã®èª¬æã次ã«ç¤ºãã¾ãã
nameï¼ã¢ããªå short_nameï¼ã¢ããªçç¥å descriptionï¼ã¢ããªã®èª¬æ start_urlï¼ã¢ããªã®ã¹ã¿ã¼ãç»é¢ã¨ãªããã¹ã®æå® display:ã¢ããªã®è¡¨ç¤ºå½¢å¼(standaloneï¼åç¬ã¢ããªå½¢å¼ãbrowserï¼ãã©ã¦ã¶è¡¨ç¤ºã®ã¾ã¾ããªã©) orientation:ç»é¢ã®åããæå®(anyï¼ã©ã®åãã§ã対å¿ããªã©) background_color:ã¢ããªã®èæ¯è²ãæå®(#FFFFFFããªã©) theme_color:ã¢ããªã®ãã¼ãã«ã©ã¼ãæå®(#FFFFFFããªã©) iconsï¼ã¢ããªã®ã¢ã¤ã³ã³ã¨ãã¦ä½¿ç¨ããç»åã®ãªã¹ã ããsrcï¼ã¢ã¤ã³ã³ç»åã®ãã¹ãæå®(/android-chrome-152x152.pngããªã©) ããsizesï¼ã¢ã¤ã³ã³ç»åã®ãµã¤ãºãæå®(152x152ããªã©) ããtypeï¼ã¢ã¤ã³ã³ç»åã®å½¢å¼ãæå®(image/pngããªã©) ããpurposeï¼ã¢ã¤ã³ã³ç»åãã»ã¼ãã¾ã¼ã³ã«åã¾ãå形表示対å¿ãã¦ãããã¨(maskable)ãªã©ãæå®
次ã«ä»åã®ä¾ã§ä½¿ç¨ããåãã¼ã®è¨å®ä¾ã示ãã¾ãã
ä¸è¨ã®åãã¼ããããªãç¨æãããã¨ã¨åè¿°ããandroid-chrome-âxâ.pngããã³android-chrome-maskable-âxâ.pngããµã¤ãºå¥ã«iconsé
åã«è¨å®ããã¨ããããã¤ã³ãã¨ãªãã¾ãã
{ "name":"ï¼ã¢ããªåï¼", "short_name":"ï¼ã¢ããªçç¥åï¼", "description":"ï¼ã¢ããªã®èª¬æï¼", "start_url":"/", "id":"/", "display":"standalone", "orientation":"any", "background_color":"#ffffff", "theme_color":"#ffffff", "icons": [ { "src": "/android-chrome-36x36.png", "sizes": "36x36", "type": "image/png" }, { "src": "/android-chrome-48x48.png", "sizes": "48x48", "type": "image/png" }, { "src": "/android-chrome-72x72.png", "sizes": "72x72", "type": "image/png" }, { "src": "/android-chrome-96x96.png", "sizes": "96x96", "type": "image/png" }, { "src": "/android-chrome-128x128.png", "sizes": "128x128", "type": "image/png" }, { "src": "/android-chrome-144x144.png", "sizes": "144x144", "type": "image/png" }, { "src": "/android-chrome-152x152.png", "sizes": "152x152", "type": "image/png" }, { "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "/android-chrome-256x256.png", "sizes": "256x256", "type": "image/png" }, { "src": "/android-chrome-384x384.png", "sizes": "384x384", "type": "image/png" }, { "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }, { "src": "/android-chrome-maskable-48x48.png", "sizes": "48x48", "type": "image/png", "purpose": "maskable" }, { "src": "/android-chrome-maskable-72x72.png", "sizes": "72x72", "type": "image/png", "purpose": "maskable" }, { "src": "/android-chrome-maskable-96x96.png", "sizes": "96x96", "type": "image/png", "purpose": "maskable" }, { "src": "/android-chrome-maskable-128x128.png", "sizes": "128x128", "type": "image/png", "purpose": "maskable" }, { "src": "/android-chrome-maskable-192x192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" }, { "src": "/android-chrome-maskable-384x384.png", "sizes": "384x384", "type": "image/png", "purpose": "maskable" }, { "src": "/android-chrome-maskable-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } ] }
åãã¡ã¤ã«èª¬æï¼sw.js
sw.jsã¯PWAã«ãããService Workerãå®è¡ããJavaScriptã§ãã
Service Workerã¨ã¯ãã©ã¦ã¶ãã¦ã§ããµã¤ããPWAã¨ãã¦åä½ãããéã«ããã¯ã°ã©ã¦ã³ãå¦çãããã·ã¥éç¥ãªã©ãå®è¡ããã¹ã¯ãªããã§ãã
Service Workerã§å©ç¨å¯è½ãªã¤ãã³ãã«ã¯ãinstallãactivateãfecthãmassageãsyncãpushã¨ãã£ããã®ããããããããã®ã¤ãã³ãã®ã¿ã¤ãã³ã°ã§å¦çããå
容ãã¹ã¯ãªããã§è¨è¿°ãã¦ãããã¨ã«ãªãã¾ãã
ãã®Service Workerã®ã¤ãã³ãã¨ã©ã¤ããµã¤ã¯ã«ã«ã¤ãã¦ã¯æ¬¡ã®åèè³æãå½¹ã«ç«ã¡ã¾ãã
Service Workeråèè³æï¼
Service Worker ã®ç´¹ä» | Web Fundamentals | Google Developers
Service worker ã®ä½¿ç¨ - Web API | MDN
ç¹ã«æè¿ã§ã¯å¾è¿°ããLighthouse Report Viewerã§PWAã®åºæºãæºããããã«ã¯installãfetchã¤ãã³ããç¨æãã¦ãªãã©ã¤ã³ã§åä½ã§ãããã¨ãå¿
è¦ã«ãªãã¾ããã
(Google Chrome 89ããããããããããã¼ãã¼ã«ã§è¦åãåºãããã«ãªãã¾ããã)
ãã®ãããä»åã®ä¾ã§ãè¦ä»¶ã«å¿
è¦ãªã¤ãã³ããç¨æããã¦ã§ããµã¤ã表示ã«å¿
è¦ãªã³ã³ãã³ãããã£ãã·ã¥ããæä½éã®ãã¸ãã¯ãService Workerã«è¿½å ãã¦ãã¾ãã
'use strict'; const CACHE_NAME = 'ï¼ãã£ãã·ã¥åï¼'; const urlsToCache = [ "ï¼ãã£ãã·ã¥ãããã¡ã¤ã«ãã¹1ï¼", "ï¼ãã£ãã·ã¥ãããã¡ã¤ã«ãã¹2ï¼", //ã»ã»ã» "ï¼ãã£ãã·ã¥ãããã¡ã¤ã«ãã¹Xï¼" ]; //installã¤ãã³ãã®å ´å //åè¿°ã®ãã¡ã¤ã«ãã¹ããã¹ã¦ãã£ãã·ã¥ã«ç»é²ãã self.addEventListener('install', function(event) { event.waitUntil( caches.open(CACHE_NAME).then(function(cache) { return cache.addAll(urlsToCache); }) ); }); //fetchã¤ãã³ãã®å ´å //ã¦ã§ããµã¤ãã¸ã®ã¢ã¯ã»ã¹ãæåããã°åå¾ã§ããå 容ããã£ãã·ã¥ã«ä¿åããä¸ã§ã¢ããªã§è¡¨ç¤ºããã //ã¦ã§ããµã¤ãã¸ã®ã¢ã¯ã»ã¹ã失æããã°ä¿åããã¦ãããã£ãã·ã¥ãã¢ããªã§è¡¨ç¤ºããã self.addEventListener('fetch', function(event) { event.respondWith(async function() { try { if (event.request.url.startsWith('http')) { var res = await fetch(event.request); var cache = await caches.open(CACHE_NAME); cache.put(event.request.url, res.clone()); return res; } return fetch(event.request); } catch (error) { console.log('Using cache'); return caches.match(event.request); } }()); });
åãã¡ã¤ã«èª¬æï¼index.js
index.jsã¯index.htmlããèªã¿è¾¼ã¿ãService Workerã§ããsw.jsãç»é²ããããã®JavaScriptã§ãã
ä»åã¯åç´ã«Service Workerã®ç»é²å¦çããå
¥ãã¦ãã¾ããã
if ('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator.serviceWorker.register('/sw.js').then(function(registration) { //Service Worker(sw.js)ãç»é²ã§ãããç¹ã«ä½ãããªãã }, function(err) { //Service Worker(sw.js)ã®ç»é²ã失æããå ´åã¯ãã©ã¦ã¶ã«ãã°ãåºãã console.log('ServiceWorker registration failed: ', err); }); }); }
åãã¡ã¤ã«èª¬æï¼index.html
index.htmlã¯ã¦ã§ããµã¤ãã®ã¡ã¤ã³ã³ã³ãã³ãã§ãHTMLã®headã¿ã°å
ã«ã¦ã§ããµã¤ãã¨ãã¦ã®ã¢ã¤ã³ã³ãPWAã«å¿
è¦ãªmanifest.jsonãindex.jsãè¨å®ãã¦ãã¾ãã
ä»åã®ä¾ã§é¢ä¿ããé¨åãæãåºãã¦è¨è¿°ããã¨æ¬¡ã®ããã«ãªãã¾ãã
<head> <!--ï½ä¸è¦é¨åã¯çç¥ããè¦ãããããã«é çªå¤æ´ãã¦ãã¾ãï½--> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"> <link rel="icon" type="image/png" sizes="36x36" href="/android-chrome-36x36.png"> <link rel="icon" type="image/png" sizes="48x48" href="/android-chrome-48x48.png"> <link rel="icon" type="image/png" sizes="72x72" href="/android-chrome-72x72.png"> <link rel="icon" type="image/png" sizes="96x96" href="/android-chrome-96x96.png"> <link rel="icon" type="image/png" sizes="128x128" href="/android-chrome-128x128.png"> <link rel="icon" type="image/png" sizes="144x144" href="/android-chrome-144x144.png"> <link rel="icon" type="image/png" sizes="152x152" href="/android-chrome-152x152.png"> <link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png"> <link rel="icon" type="image/png" sizes="256x256" href="/android-chrome-256x256.png"> <link rel="icon" type="image/png" sizes="384x384" href="/android-chrome-384x384.png"> <link rel="icon" type="image/png" sizes="512x512" href="/android-chrome-512x512.png"> <link rel="icon" type="image/png" sizes="16x16" href="/icon-16x16.png"> <link rel="icon" type="image/png" sizes="24x24" href="/icon-24x24.png"> <link rel="icon" type="image/png" sizes="32x32" href="/icon-32x32.png"> <link rel="icon" type="image/png" sizes="36x36" href="/icon-36x36.png"> <link rel="icon" type="image/png" sizes="48x48" href="/icon-48x48.png"> <link rel="icon" type="image/png" sizes="72x72" href="/icon-72x72.png"> <link rel="icon" type="image/png" sizes="96x96" href="/icon-96x96.png"> <link rel="icon" type="image/png" sizes="128x128" href="/icon-128x128.png"> <link rel="icon" type="image/png" sizes="144x144" href="/icon-144x144.png"> <link rel="icon" type="image/png" sizes="152x152" href="/icon-152x152.png"> <link rel="icon" type="image/png" sizes="160x160" href="/icon-160x160.png"> <link rel="icon" type="image/png" sizes="192x192" href="/icon-192x192.png"> <link rel="icon" type="image/png" sizes="196x196" href="/icon-196x196.png"> <link rel="icon" type="image/png" sizes="256x256" href="/icon-256x256.png"> <link rel="icon" type="image/png" sizes="384x384" href="/icon-384x384.png"> <link rel="icon" type="image/png" sizes="512x512" href="/icon-512x512.png"> <link rel="manifest" href="/manifest.json"> <script src="/index.js"></script> </head>
Lighthouse Report Viewerã®ä½¿ãæ¹
ããããã¯Googleãæä¾ããLighthouse Report Viewerã®ä½¿ãæ¹ãç´¹ä»ãã¾ãã
Lighthouse Report Viewerã¯PerformanceãAccessibilityãBest PracticesãSEOã¨ãã£ãã«ãã´ãªã«ã¤ãã¦100ç¹æºç¹ã§ã¦ã§ããµã¤ãã®å¯¾çç¶æ³ãè©ä¾¡ããPWAã«ã¤ãã¦ãåºæºãæºããã¦ãããã確èªã§ãããµã¤ãããã©ã¼ãã³ã¹æ¸¬å®ãã¼ã«ã§ãã
ãã ããLighthouse Report Viewerã®è©ä¾¡ã¨ã¦ã§ããµã¤ããæç¨ãªã³ã³ãã³ããçºä¿¡ãã¦ãããã¯é¢ä¿ããã¾ããã
ãã®ãããæ¬å½ã®æå³ã§ã¦ã§ããµã¤ãã®ä¾¡å¤ãé«ããããã«ã¯ãµã¤ãããã©ã¼ãã³ã¹ã¨æç¨ãªã³ã³ãã³ãçºä¿¡ã®ä¸¡æ¹ãæèããå¿
è¦ãããã¨èãããã¾ãã
ãã®ç¹ãèæ
®ã«ããã¦ãµã¤ãããã©ã¼ãã³ã¹ãè©ä¾¡ããLighthouse Report Viewerã®ä½¿ãæ¹ãè¦ã¦ããã¾ãããã
Google Chromeãªã©ã®ãããããã¼ãã¼ã«ããLighthouseãèµ·åããæ¹æ³
PCçã®Google ChromeãMicrosoft EdgeãVivaldiãªã©Chromiumãã¼ã¹ã®ãã©ã¦ã¶ã§ããã°Google Chromeã¨åæ§ã®ãããããã¼ãã¼ã«ã使ç¨ã§ãã¾ãã
ãã®ãããããã¼ãã¼ã«ã®ä¸ã«ããLighthouse Report Viewerã®å®è¡æ©è½ã使ç¨ããã®ããã®æ¹æ³ã«ãªãã¾ãã
ç¹ã«Google Chromeã®Betaçãªã©å
è¡ãªãªã¼ã¹ããã¦ãããã®ã§ã¯ä»å¾å°å
¥ãäºå®ããã¦ããLighthouseã®æ°ãããã¼ã¸ã§ã³ã使ç¨ã§ãããã¨ããããããæ°ããåºæºã§ã®è©ä¾¡ãå¿
è¦ãªå ´åã¯è©¦ãã¦ã¿ãã¨ããã¨æãã¾ã(å®éãç§ãGoogle Chrome Betaçã§Lighthouseãèµ°ããããã¨ãå¤ãã§ã)ã
â ãããããã¼ãã¼ã«ããã®Lighthouseèµ·åæé
- è©ä¾¡å¯¾è±¡ã®ã¦ã§ããµã¤ããåè¿°ãããã©ã¦ã¶ã§éã
- ã·ã§ã¼ãã«ããã³ãã³ããCtrlï¼Shiftï¼Iãã§ãããããã¼ãã¼ã«ãéã
-
ãããããã¼ãã¼ã«ã¡ãã¥ã¼ã®ãLighthouseãã¿ããéã
(表示ããã¦ããªãå ´åã¯ã>>ããã¯ãªãã¯ãã¦ã¡ãã¥ã¼ãå±éãããLighthouseãã¿ããéã) - ãGenerate reportããå®è¡ããã¨ãç¾å¨éãã¦ããã¦ã§ããµã¤ãã«å¯¾ãã¦Lighthouse Report Viewerãå®è¡ããã
- çµæã表示ãããã¾ã§ãã°ããå¾ ã¤
Google Chromeãªã©ã«æ¡å¼µæ©è½ãã¤ã³ã¹ãã¼ã«ãã¦ä½¿ç¨ããæ¹æ³
PCçã®Google ChromeãMicrosoft EdgeãVivaldiãªã©Chromiumãã¼ã¹ã®ãã©ã¦ã¶ã§ããã°Google Chromeã¨åæ§ã«Lighthouseã®æ¡å¼µæ©è½ãã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
ãã©ã¦ã¶ã§è©ä¾¡å¯¾è±¡ã®ã¦ã§ããµã¤ãã表示ããLighthouseæ¡å¼µæ©è½ããLighthouse Report Viewerãå®è¡ããã®ããã®æ¹æ³ã§ãã
ãã ãåè¿°ã®ãããããã¼ãã¼ã«ã¨ã¯ç°ãªããã¼ã¸ã§ã³ã®Lighthouse Report Viewerãå®è¡ããããã¨ãããã¾ãã
ããæ°ãããã¼ã¸ã§ã³ã®Lighthouse Report Viewerã§æ¤è¨¼ãããå ´åã¯åè¿°ã®Google Chrome Betaçã§ãããããã¼ãã¼ã«ã使ç¨ããæ¹ãããã§ãããã
â æ¡å¼µæ©è½ããã®Lighthouseèµ·åæé
- Chromeæ¡å¼µæ©è½ããµãã¼ããã¦ãããã©ã¦ã¶ã§ãLighthouse - Chrome ã¦ã§ãã¹ãã¢ãã®ãã¼ã¸ãéãããChromeã«è¿½å ãããLighthouseæ¡å¼µæ©è½ãã¤ã³ã¹ãã¼ã«ããã
- è©ä¾¡å¯¾è±¡ã®ã¦ã§ããµã¤ãããã©ã¦ã¶ã§éã
-
ãã©ã¦ã¶ã®ã¢ãã¬ã¹ãã¼ã®å³å´ãªã©ã®æ¡å¼µæ©è½ä¸è¦§ããã¤ã³ã¹ãã¼ã«ããLighthouseãã¯ãªãã¯ãã
- ãGenerate reportããå®è¡ããã¨ãç¾å¨éãã¦ããã¦ã§ããµã¤ãã«å¯¾ãã¦Lighthouse Report Viewerãå®è¡ããã
- çµæã表示ãããã¾ã§ãã°ããå¾ ã¤
Lighthouse Report Viewerã®URLã«ç´æ¥å ¥åãã¦èµ·åããæ¹æ³
ãã®æ¹æ³ã¯åè¿°ããLighthouseã®æ¡å¼µæ©è½ããªã¯ã¨ã¹ããéãURLãç´æ¥ä½¿ç¨ããæ¹æ³ã§ãã
æ¡å¼µæ©è½ãã¤ã³ã¹ãã¼ã«ããå¿
è¦ããªããSafariãªã©ã®Lighthouseæ¡å¼µæ©è½ããµãã¼ããã¦ããªããã©ã¦ã¶ãã¹ãã¼ããã©ã³ã§ãå®è¡ã§ãã¾ãã
â Lighthouse Report Viewer URLããã®Lighthouseèµ·åæé
-
次ã®URLã®ï¼æ¤è¨¼ããURLï¼ã®ç®æã«è©ä¾¡å¯¾è±¡ã®ã¦ã§ããµã¤ãã®URLãå
¥åãã¦ãã©ã¦ã¶ã§è¡¨ç¤ºãããã
https://googlechrome.github.io/lighthouse/viewer/?psiurl=ï¼æ¤è¨¼ããURLï¼&strategy=mobile&category=performance&category=accessibility&category=best-practices&category=seo&category=pwa&utm_source=lh-chrome-ext
- çµæã表示ãããã¾ã§ãã°ããå¾ ã¤
Lighthouse Report Viewerã§ã®çµæç»é¢
Lighthouse Report Viewerãå®è¡ãã¦ãã°ããããã¨PerformanceãAccessibilityãBest PracticesãSEOã®ã«ãã´ãªã«ã¤ãã¦ã®æ¡ç¹çµæã¨PWAã®å¯¾å¿å¯å¦ã表示ããã¾ãã
è©ä¾¡ã®çµæãä½ãåé¡ã§ãããã¯çµæç»é¢ã®ä¸é¨ã¸åã«ãã´ãªãã¨ã«å¯¾çã®ãã³ãã表示ãããããã«ãªã£ã¦ããã®ã§ããã®å¯¾çã調æ»ããªãã対å¿ããã¦ããã¾ãã
次ã®ç»åã¯ã«ãã´ãªã®æ¡ç¹ãä¸é¨100ç¹ãéæã§ããªãã£ãå ´åã®Lighthouse Report Viewerçµæç»é¢ã§ãã対çéä¸ã§ã¯ãã»ã¨ãã©ã®å ´åã«ãã®ã·ã³ãã«ãªç»é¢ãè¦ããã¨ã«ãªãã¾ãã
Lighthouse Report Viewerã§ã®æ¤è¨¼â調æ»â対çãç¹°ãè¿ãå®æ½ãã¦åã«ãã´ãªã®æ¡ç¹ããã¹ã¦100ç¹ã¨ãªããPWAã®åºæºãæºããã¨é»èæ¯ã«è±ç«ãã¼ã³ã¨ãªãã¾ãã
ãããã¡ãªã¢ãã¡ã¼ã·ã§ã³ã§ãããããã¾ã§ã®ä½æ¥éç¨ã§è¦å´ãããã»ã©å
å¿å¬ãããªã£ã¦ãã¾ãç²ãªæ¼åºã§ãã
(ã¤ãæè¿ã®ä»æ§å¤æ´ã§è±ç«ã¯ä¸ãããªããªã£ãããã§ããâ»2022-02-18ï¼åã³è±ç«ãä¸ããä»æ§ã«ãªã£ãã¿ããã§ãã)
ä½è«ã§ãããç§ã®ã¦ã§ããµã¤ãã®å ´åãç»åã®å®¹éå§ç¸®å¯¾å¿ã¯ããä¸æ¹ã§ç»åãµã¤ãºã ãã¯ç¸®å°ãã¦ããªããã¨ããã£ã¦ãPerformanceã«ãã´ãªã§100ç¹æºç¹ã«ãªãã®ã¯åæ°åã«1åç¨åº¦ã§ãã
試è¡ããåã«ãã£ã¦è©ä¾¡ç¹ãå¤åããã®ã¯Lighthouse Report Viewerããã¦ã§ããµã¤ãéã®åç·é度ãè©ä¾¡ã«å½±é¿ãã¦ããããããããã¾ããã
ç»åãµã¤ãºã縮å°ãã¦ããªãçç±ã¯ä»å¾ãã¢ãã¤ã«ç«¯æ«ã®åç·ã5Gã«ãªãé«éåãããã¨ã§ç»å表示ã®ããã©ã¼ãã³ã¹ã¸ã®å½±é¿ãä½æ¸ããã¦ããéç¨ãå®ç¹è¦³æ¸¬ãããã¨èããããã§ãã
Lighthouseã§é«å¾ç¹ãåºãããã«é æ ®ãããã¨
ç§ãä»å試ããã®ã¯index.htmlã®ã¿ã®è»½éã¦ã§ããµã¤ããªã®ã§æåããããç¨åº¦ã®å¾ç¹ã¯åºã¦ãã¾ããã
ãã ãããã§ãããã¯é
æ
®ãã¦ãããªãã¨Lighthouseã§é«å¾ç¹ãåºãã®ã¯é£ããã¨ãããã¤ã³ããæãã¦ããã¾ãã
ã¬ã¹ãã³ã·ã対å¿
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
ãã¹ã¿ã¤ã«ã·ã¼ãã®@media
ãªã©ã使ç¨ãã¦PCã®å¤§ç»é¢ããApple Watchç¨åº¦ã®å°ç»é¢ã¾ã§æè»ã«è¡¨ç¤ºã§ããããã«ãã¾ããã
ã¬ã¹ãã³ã·ããå®éã«å¯¾å¿ã§ãããã¯ãGoogle Chromeã®ãããããã¼ãã¼ã«ã§å·¦ä¸ã®ã¹ãã¼ããã©ã³ã¨ã¿ãã¬ããã®ãã¼ã¯ãã¯ãªãã¯ããããã¤ã¹ãã¼ã«ãã¼ãæå¹ã«ãã¦å種ã¹ãã¼ããã©ã³ãã«ã¹ã¿ã ããã¤ã¹(Apple Watchãã¬ã©ãã®ãµã¤ãºãå ¥å)ãæå®ãã¦ç¢ºèªãã¦ãã¾ããã
æåã®å¤§ããã¨è²
æåã®å¤§ããã¯ã¢ãã¤ã«ãèæ ®ãã¦17px以ä¸ã«ãã¾ãããå½åã¯16pxã«ãã¦ãã¾ãããããGoogle Search Consoleãã®æ¹ã§ãããã¹ããå°ãããã¦èªãã¾ãããã®ã¨ã©ã¼ãã§ãããã17pxã«å¤æ´ãããã¨ã§ã¯ãªã¢ãã¾ããã
æåè²ã¯èæ¯è²ã¨ã®ã³ã³ãã©ã¹ãæ¯4.5以ä¸ã¨ãªãããã«é è²ãé¸æãã¾ããã
ã³ã³ãã©ã¹ãæ¯ã¯æåã®å¤ªãã«ãé¢ä¿ãã¦ããããã次ã®ãã¼ã«ã使ç¨ãã¦èæ¯è²ãæåã®å¤ªããèæ ®ããªããã³ã³ãã©ã¹ãæ¯4.5以ä¸ã¨ãªãæåè²ã決ãã¦ããã¾ããã
WebAIM: Contrast Checkerç»åã®è»½éå
æè¿ã§ã¯æ§ã ãªç»åå§ç¸®ãã¼ã«ãããã®ã§ããããã使ç¨ãã¦ç»åå§ç¸®ã試ãã¦æãå§ç¸®å¹æããã£ãç»åãæ¡ç¨ãã¾ããã
ãã ãåè¿°ã®ããã«ç§ã®å ´åã¯ãµã¤ãºã®ç¸®å°ã¯ããªãã£ããããå®å ¨ã«Lighthouseã®ã¬ãã¼ãã«å¾ã£ãããã§ã¯ããã¾ããã
Lighthouseã§é«å¾ç¹ãç®æããã¨ã¯ãµã¤ãããã©ã¼ãã³ã¹ã®è¦³ç¹ã§ã¯è¯ããã¨ã§ããã注æããã¹ããªã®ã¯åè¿°ããããã«Lighthouse Report Viewerã¯ããã¾ã§ãµã¤ãããã©ã¼ãã³ã¹æ¸¬å®ãã¼ã«ãªã®ã§ãã¦ã§ããµã¤ããæç¨ãªã³ã³ãã³ããçºä¿¡ãã¦ãããã¯è©ä¾¡ãã¦ããªãç¹ã§ãã
ãã®ãããLighthouse Report Viewerã®è©ä¾¡ãå
ã«åå対çãã¨ã£ã¦100ç¹ãåããªãã¦ããå¿
è¦ãªã³ã³ãã³ã(è²ããªãã³ã³ãã³ã)ãåããã¨ã¯ããã¹ãã§ã¯ãªãã¨ç§ã¯èãã¦ãã¾ãã
ã¦ã§ããµã¤ãã«ã¯ããããã³ã³ãã³ããé
ä¿¡ããç®çãããããããã®ç®çãéæãããã¨ãæåªå
ã§ããããµã¤ãããã©ã¼ãã³ã¹ã¯ãã®ã³ã³ãã³ãé
ä¿¡ãæé©åãããã®ã ã¨ãããã¨ãå¿ããªãããã«ãããã¨æã£ã¦ãã¾ãã
Lighthouse Report Viewerã§è©ä¾¡ããã¦ããã¨é«å¾ç¹ã®ããã«å¿
è¦ãªã³ã³ãã³ãã¾ã§åãã¨ããé¸æè¢ãé ã«æµ®ããã§ãããã¨ãããã®ã§ãèªåã¸ã®åå¿ã®ããã«ããã®ãã¨ãè¨è¼ãã¦ããã¾ããã
åèï¼
Tech Blog with related articles referenced
ã¾ã¨ã
ä»åã¯index.htmlã®ã¿ã®ç°¡åãªã¦ã§ããµã¤ãã«PWAãå°å
¥ãã¦ãLighthouse Report Viewerã®åã«ãã´ãªã¼ã®ã¹ã³ã¢ãå¯è½ãªéã100ç¹ã«è¿ã¥ããããã«å¯¾çãå®æ½ãã¦ã¿ã¾ããã
ãã®éç¨ã§ã¦ã§ããµã¤ãã®PWAã¸ã®å¯¾å¿æ¹æ³ãããã£ãã®ã¯å¤§ããªåç©«ã§ãããããã«å ãã¦æãå¹æã大ããã¨æããã®ã¯Lighthouse Report Viewerã«ããç£æ»ã¨ææäºé
ã®ä¿®æ£ã®ç¹°ãè¿ãã«ãã£ã¦ãã¦ã§ããµã¤ãã®SEO対çããã®æµãã®ä¸ã§å¦ç¿ããã³å®æ½ãããã¨ãã§ãããã¨ã§ãã
SEOã«é¢ããç¥èãæ¤è¨¼ãã¼ã«ãä½ããªãç¶æ
ã§ãµã¤ãã®è³ªãåä¸ããã®ã¯ç¥èã®ç¿å¾ã調æ»ã«é常ã«ã³ã¹ãããããã¾ãããLighthouse Report Viewerã®ã¬ãã¼ããåèã«ãã¦å¯¾å¦æ¹æ³ã調æ»ããé©ç¨ããã¨ãããã¨ãç¹°ãè¿ããã¨ãè¨ãã°éæ¨ã®ããã«ãªã£ã¦ããã¨æãããã¾ããã
ããã¦ããã®ããã«å¦ç¿ãé²ããªãã試è¡é¯èª¤ãç¶ããçµæãã¦ã§ããµã¤ãã®PWA対å¿ã®æ¹æ³ã¨æ¨ä»ã®SEO対çãé¨åçã«ç解ã§ããç¡é§ã«PWAã«å¯¾å¿ãããµã¤ã(èªå·±ç´¹ä»)ãã§ãã¾ããã
- [English Edition] How to create a PWA(Progressive Web Apps) compatible website on AWS and use Lighthouse Report Viewer