Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GatsbyでPWAやってみた / Tried PWA using Gatsby
Search
Kota Nonaka
August 29, 2018
Programming
460
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
440
React Nativeと半年間戦ってわかったコト / What I learned after fighting React Native for half a year
uutarou10
1
280
TypeScript+Firebaseで作るサーバーレスアプリケーション/Create serverless app with TypeScript + Firebase
uutarou10
1
1.2k
CSS ド入門ハンズオン/CSS beginner's hands-on
uutarou10
2
97
初心者による初心者のためのKubernetesハンズオン
uutarou10
4
3.3k
Other Decks in Programming
See All in Programming
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
140
APNsからLive Activityを開始する話
yumnumm
0
160
Domain-Driven Transformation
hschwentner
2
2.3k
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.2k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
220
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
320
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
160
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
250
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
34
16k
JRuby: Past, Present, and Future
headius
0
230
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
370
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Between Models and Reality
mayunak
4
490
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
The Cult of Friendly URLs
andyhume
79
7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Docker and Python
trallard
47
4.2k
Designing Powerful Visuals for Engaging Learning
tmiket
1
600
Design in an AI World
tapps
1
350
Raft: Consensus for Rubyists
vanstee
142
7.7k
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✨