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
Ionic+PWA対応サイトのLighthouseスコアを34から81まで上げる話
Search
scrpgil
May 20, 2018
Programming
1.2k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ionic+PWA対応サイトのLighthouseスコアを34から81まで上げる話
Ionic Meetup Tokyo #4(2018/05/20)にてLTした資料です。
スコアアップを図ったWebサイトは以下。
https://aahub.org
scrpgil
May 20, 2018
More Decks by scrpgil
See All by scrpgil
Firebase Realtime DB から ActionCable 移行のマネジメントの話
scrpgil
0
130
フレーム問題で考えてみるやる夫スレViewer
scrpgil
0
150
ChatGPTとLangChain さわってみた
scrpgil
0
130
久しぶりに ionic startしてみた
scrpgil
0
270
Ionic 6でWeb3やってみた
scrpgil
0
240
Ionic×Angularで作る ストーリーズ風UI
scrpgil
0
480
Angularで作るモバイルアプリ開発〜スタートアップの開発事情〜
scrpgil
0
720
夢のクロスプラットフォーム開発
scrpgil
0
400
Stencil JSについて
scrpgil
0
470
Other Decks in Programming
See All in Programming
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
730
メールのエイリアス機能を履き違えない
isshinfunada
0
250
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
210
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
110
Flow は今どうなっているか
mizdra
PRO
0
720
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
280
プロポーザルを書いてもらう
pvcresin
0
580
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
240
仕様駆動開発の消費期限
watany
20
9k
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
How to Talk to Developers About Accessibility
jct
2
520
Ruling the World: When Life Gets Gamed
codingconduct
0
310
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
A better future with KSS
kneath
240
18k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Faster Mobile Websites
deanohume
310
32k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
410
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
800
Documentation Writing (for coders)
carmenintech
77
5.5k
Transcript
Lighthouseのスコア (パフォーマンス)を 34→81まで上げる Ionic Meetup Tokyo #4 @xiaca
前段
前回名古屋のIonic Meetupに参加した時 Lighthouseを知りました
さっそく自分のサイトを計測してみたら 34点しかありませんでした。
さっそく自分のサイトを計測してみたら 34点しかありませんでした。 これはよくない
Lighthouseのスコア (パフォーマンス)をあげよう
削減したサイト 参考:https://aahub.org 概要: AAのオンラインビューアー Ionicで作成したPWA対応のサイト 特徴: 画像を使用していない カスタムフォントを使用している
まずは、CSSの削減。 参考 https://julienrenaux.fr/2017/07/20/optimized-ionic-angular-css-bundle-for-pwas/ 580Kb main.css
iOS、WindowsPhoneのCSSは捨てる ・ionic-app-scriptのconfig/sass.config で設定 ・IonicModule.forRootでmodeをmdだ け読み込むように変更 580Kb→290Kbまで削減 ・node_modules/@ionic/app-scripts/config/ sass.config.js ・src/app/app.module.ts
themeのcolorsは使わない ・ひとつ消す毎に14Kbくらい削減 ・color属性は使わずcssで記述する ように変更 290Kb→198Kbまで削減
使わないコンポーネントのCSSを削除 ・とくにgridは削除すると30KB削減さ れるので狙い目 ・node_modules/@ionic/app-scripts/config/ sass.config.js 198Kb→100Kbまで削減
purify-cssを使った ・不要なCSSを削除してくれるツー ル 100Kb→70Kbまで削減
34→56まで改善した
34→56まで改善した この調子
カスタムフォントから漢字グリフを削除 1.4Mb→45Kbまで削減 ・AAに漢字は不要 ・漢字は等幅なのでAA表示に影響なし 亻人艹丁十 間凧越蟹願
カテゴリ一覧の構造体を別ファイル化 ・カテゴリ一覧を表示するための構造体情報を埋 め込んでいたけど、jsonファイルにして別読み込 みするように変更 1.1Mb→120Kbまで削減(main.js)
56→69まで改善した 体感レベルでは相当早くなってきた
56→69まで改善した 体感レベルでは相当早くなってきた もうひとおし
ioniconsの削除 ・必要なiconだけ読み込むように変更 ioniconの読み込みが不要に
HTMLを削減 ・buttonとかをngForで描画するように変更 10Kb削減(main.js)
CSSをインライン化 ・ionic build --prod後のmain.cssをindex.html に移植 RenderBlockingStyleSheetが改善(810ms→0ms)
69→76まで改善した ついに表示が緑色(オールグリーン)に
69→76まで改善した ついに表示が緑色(オールグリーン)に が、しかし
ここから先は何をやっても変わらない... • httpClientをaxiosにしてみる • CloudFlareを使ってみる
最後 環境を変えてみた
ゲーミングPCと有線LANの環境で測定 ・中国から輸入したゲーミングPC CPU: Intel Core i7-7700 Quad Core 3.6GHz メモリ:8GB
DDR4 RAM SSD:Colorful SL500 240G Hard Disk
81を超えた!
Ionic v4への期待 • Ionic-angular(310Kb)の軽量化
引き続きスコアアップを目指します
None
以上、 ご清聴ありがとうございました。