Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GatsbyでPWAやってみた / Tried PWA using Gatsby
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kota Nonaka
August 29, 2018
Programming
450
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GatsbyでPWAやってみた / Tried PWA using Gatsby
2018/08/29 ゆるはち.it Vol.1 でのLT資料です。
https://yuruhachi-it.connpass.com/event/96878/
Kota Nonaka
August 29, 2018
More Decks by Kota Nonaka
See All by Kota Nonaka
このあとからできる アクセシビリティ向上 / Accessibility improvements that can be made after this
uutarou10
0
430
React Nativeと半年間戦ってわかったコト / What I learned after fighting React Native for half a year
uutarou10
1
270
TypeScript+Firebaseで作るサーバーレスアプリケーション/Create serverless app with TypeScript + Firebase
uutarou10
1
1.2k
CSS ド入門ハンズオン/CSS beginner's hands-on
uutarou10
2
92
初心者による初心者のためのKubernetesハンズオン
uutarou10
4
3.3k
Other Decks in Programming
See All in Programming
Vite+ Unified Toolchain for the Web
naokihaba
0
280
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
260
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
330
Claspは野良GASの夢をみるか
takter00
0
180
Oxlintのカスタムルールの現況
syumai
6
1.1k
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
450
TAKTでAI駆動開発の品質を設計する
j5ik2o
6
1.2k
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
3Dシーンの圧縮
fadis
1
740
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
390
Agentic UI
manfredsteyer
PRO
0
140
New "Type" system on PicoRuby
pocke
1
830
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
330
Navigating Team Friction
lara
192
16k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
200
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Prompt Engineering for Job Search
mfonobong
0
340
The Curse of the Amulet
leimatthew05
1
13k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
610
Typedesign – Prime Four
hannesfritz
42
3.1k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
370
Test your architecture with Archunit
thirion
1
2.3k
Transcript
Gatsbyで PWA やってみた 2018/08/29 ゆるはち.it Kota Nonaka (@uutarou10)
速報
けっこう酔ってきた
Gatsbyとは? • https://www.gatsbyjs.org/ • 一言で言うと静的サイトジェネレーター • Jekyll/Hugo/Hexoなどと同じジャンル w όοΫΤϯυʹ3FBDU(SBQI2-Λ࣋ͭ
None
Data sourceとして Markdown/外部API等を利用 GraphQLを用いてページ生成に 必要な情報の抽出 Reactで作成したViewで利用 Gatsby公式サイト(https://getgatsbyjs.org)より引用
ここがすごいぞGatsby • Data sourceが豊富 • eg. Markdown / YAML /
WordPress / Contentful / esa.io / etc... • React / GraphQL • 既存の知識やライブラリがそのまま使える • 吐き出されるのは静的なSPA (Single Page Application) • ページ遷移などが爆速 • デプロイも成果物をNetlify / GitHub Pagesなどへ配置するだけ
(語ると長くなりそうなので) 本題
作った https://mogam.in https://github.com/uutarou10/mogam.in
PWA化してみる • gatsby-plugin-manifest • サイトをPWAとして認識してもらうために必要なmanifestの自動生成 • アイコン画像の最適化 • gatsby-plugin-offline •
コンテンツのキャッシュを行うServiceWorkerを自動生成
/* ---------- PWA ---------- */ { resolve: `gatsby-plugin-manifest`, options: {
name: `Mogami#Log`, short_name: `Mogami#Log`, start_url: `/`, background_color: `#f7f0eb`, theme_color: `#00D1B2`, display: `minimal-ui`, icon: `src/images/icon.png`, } }, `gatsby-plugin-offline`, manifestの内容を定義 iconは解像度の大きいものを 作成することで最適な解像度の 画像をビルドプロセスで 用意してくれる 上記はgatsby-config.jsの一部抜粋です。 詳しくは先ほどのリポジトリをご覧ください…!
結果
結果 ホーム画面への追加 ポップアップが表示 manifestに指定した theme colorが反映 Android 5.1.1 / Google
Chrome 68で検証
結果 "OESPJE(PPHMF$ISPNFͰݕূ 機内モードでもページ遷移可能
とっても簡単
しかも!
None
Progressive Web App 満点!!
ところで…
PWA化のメリットは…? (ブログという観点で見ると…) • Lighthouseのスコアが上がって嬉しい(マジで) • (ユーザーがたくさんいるサイトではないので 離脱率/直帰率等への影響は不明) • 今後リファレンス的に使える情報が増えたときに 手元に置いておく用途には最適
• WebPushなどを組み合わせると離脱防止に効果があるかもしれない • ブログをPWA化するメリットはさほど大きくない…?
まとめ・感想 • Gatsbyを使ったサイトをPWA化するのは本当にかんたん • config書く時間 < アイコン作る時間 • 静的サイトをPWA化することでメリットが得られるサイトは限定的? •
ライブラリのドキュメントとか? • PWAとして使うか否かはユーザーが選べばいい/導入は一瞬 やっておいて損はない(と思う)
GatsbyでLet's PWA✌
Thanks✨