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
Vue.js, PWA & The Subway Dilemma
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ignacio Anaya
May 17, 2019
Technology
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vue.js, PWA & The Subway Dilemma
Ignacio Anaya
May 17, 2019
More Decks by Ignacio Anaya
See All by Ignacio Anaya
Security is not a feature‼️
ianaya89
2
540
Rompiendo Paradigmas Otra Vuez! 🔨📜3️⃣
ianaya89
0
170
Security is not a feature!
ianaya89
1
400
What's next in Vue 3? 🖖 3️⃣
ianaya89
0
150
What's next in Vue 3? 🖖 3️⃣
ianaya89
0
310
PWA with PWF
ianaya89
0
69
Decentralizing the Web with JavaScript
ianaya89
0
170
hey-devs-time-to-care-about-web-apps-security.pdf
ianaya89
0
140
A Token Walks into SPA
ianaya89
0
640
Other Decks in Technology
See All in Technology
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
130
Kiroで書いた 設計書 が AI レビューの 採点基準 になる
ezaki
0
110
攻撃者視点で考えるDetection Engineering
cryptopeg
3
1.8k
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
2
640
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
2k
2026TECHFRESH畢業分享會 - 葬送的通靈師:化系統與用戶雜訊成行動訊號
line_developers_tw
PRO
0
1.1k
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
860
「エンジニア進化論」2028年の開発完全自動化、エンジニアはどう進化するか
cyberagentdevelopers
PRO
6
5.2k
AIの性能が向上しても未解決な組織の重大問題は何か?/An Unsolved Organizational Problem in the Age of AI
moriyuya
4
680
MCP Appsを作ってみよう
iwamot
PRO
4
660
入門!AWS Blocks
ysuzuki
1
130
2026 TECHFRESH 畢業分享會 - AI-Native 重塑軟體工程與虛擬講師
line_developers_tw
PRO
0
1.1k
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
Crafting Experiences
bethany
1
180
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
410
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Why Our Code Smells
bkeepers
PRO
340
58k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
330
A Soul's Torment
seathinner
6
2.9k
Documentation Writing (for coders)
carmenintech
77
5.4k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
HDC tutorial
michielstock
2
710
Transcript
Vue.js, PWA & The Subway Dilemma ! "# ! @ianaya89
Vue.js, PWA & The Subway Dilemma - @ianaya89 1
! Nacho Anaya ! @ianaya89 • JavaScript Engineer @BloqInc •
Ambassador @Auth0 • Tech Speaker @MozTechSpeakers • Organizer @Vuenos_Aires Vue.js, PWA & The Subway Dilemma - @ianaya89 2
!" Vue.js, PWA & The Subway Dilemma - @ianaya89 3
! Subway Dilemma Vue.js, PWA & The Subway Dilemma -
@ianaya89 4
Vue.js, PWA & The Subway Dilemma - @ianaya89 5
Vue.js, PWA & The Subway Dilemma - @ianaya89 6
Vue.js, PWA & The Subway Dilemma - @ianaya89 7
Vue.js, PWA & The Subway Dilemma - @ianaya89 8
! ✈ # Vue.js, PWA & The Subway Dilemma -
@ianaya89 9
Vue.js, PWA & The Subway Dilemma - @ianaya89 10
! Tools + Standards + Best Prac1ces Vue.js, PWA &
The Subway Dilemma - @ianaya89 11
! Web based applica,ons Vue.js, PWA & The Subway Dilemma
- @ianaya89 12
! Apps with a link... Vue.js, PWA & The Subway
Dilemma - @ianaya89 13
! Some Stats Vue.js, PWA & The Subway Dilemma -
@ianaya89 14
! " % ⏱ Use Mobile Web Vue.js, PWA &
The Subway Dilemma - @ianaya89 15
! " % ⏱ Use Na've Apps Vue.js, PWA &
The Subway Dilemma - @ianaya89 16
Vue.js, PWA & The Subway Dilemma - @ianaya89 17
! " % ! 3 Apps Vue.js, PWA & The
Subway Dilemma - @ianaya89 18
! ! Installed Apps Vue.js, PWA & The Subway Dilemma
- @ianaya89 19
! " % ! " Reach more audience Vue.js, PWA
& The Subway Dilemma - @ianaya89 20
! Progressives Vue.js, PWA & The Subway Dilemma - @ianaya89
21
! ⚡ Vue.js, PWA & The Subway Dilemma - @ianaya89
22
! Na$ve Apps • ! OS Feauteres • " Reach
• ❌ Vue.js, PWA & The Subway Dilemma - @ianaya89 23
! Web Apps • ! OS Features • " Reach
• ❌ Vue.js, PWA & The Subway Dilemma - @ianaya89 24
!" PWA • ! OS Features • ! Reach •
✅ Vue.js, PWA & The Subway Dilemma - @ianaya89 25
! Advantages • ♻ Deploy / Update / Installables •
" Offline Support • #$ Cross Device • % Code Source • & Bye Stores! Vue.js, PWA & The Subway Dilemma - @ianaya89 26
! Imagine a world without stores... Vue.js, PWA & The
Subway Dilemma - @ianaya89 27
Vue.js, PWA & The Subway Dilemma - @ianaya89 28
! F.I.R.E. Vue.js, PWA & The Subway Dilemma - @ianaya89
29
! Fast Vue.js, PWA & The Subway Dilemma - @ianaya89
30
! Integrated Vue.js, PWA & The Subway Dilemma - @ianaya89
31
! Reliable Vue.js, PWA & The Subway Dilemma - @ianaya89
32
! Engaging Vue.js, PWA & The Subway Dilemma - @ianaya89
33
Vue.js, PWA & The Subway Dilemma - @ianaya89 34
! Vue.js, PWA & The Subway Dilemma - @ianaya89 35
! Browsers Vue.js, PWA & The Subway Dilemma - @ianaya89
36
! whatwebcando.today Vue.js, PWA & The Subway Dilemma - @ianaya89
37
Vue.js, PWA & The Subway Dilemma - @ianaya89 38
Vue.js, PWA & The Subway Dilemma - @ianaya89 39
! Web App Manifest Vue.js, PWA & The Subway Dilemma
- @ianaya89 40
Vue.js, PWA & The Subway Dilemma - @ianaya89 41
Vue.js, PWA & The Subway Dilemma - @ianaya89 42
! Service Workers Vue.js, PWA & The Subway Dilemma -
@ianaya89 43
Vue.js, PWA & The Subway Dilemma - @ianaya89 44
Vue.js, PWA & The Subway Dilemma - @ianaya89 45
sw.js self.addEventListener('install', event => { console.log('Installing Service Worker ...', event)
}) self.addEventListener('activate', event => { console.log('Activating Service Worker ...', event) }) self.addEventListener('fetch', event => { console.log('Fetching something ....', event) event.respondWith(fetch(event.request)) }) Vue.js, PWA & The Subway Dilemma - @ianaya89 46
main.js if ('serviceWorker' in navigator) { navigator.serviceWorker.register('./sw.js') .then(() => console.log('Service
worker registered!')) } Vue.js, PWA & The Subway Dilemma - @ianaya89 47
! • ! Installable • " Cache App Shell •
# Dynamic Cache • $ Background Sync & Push No?fica?ons Vue.js, PWA & The Subway Dilemma - @ianaya89 48
! Vue.js, PWA & The Subway Dilemma - @ianaya89 49
! DX Vue.js, PWA & The Subway Dilemma - @ianaya89
50
! vue-cli $ npm i -g @vue/cli $ vue create
[app-name] Vue.js, PWA & The Subway Dilemma - @ianaya89 51
! pwa-plugin Vue.js, PWA & The Subway Dilemma - @ianaya89
52
! Already have a project? $ vue add @vue/pwa Vue.js,
PWA & The Subway Dilemma - @ianaya89 53
Vue.js, PWA & The Subway Dilemma - @ianaya89 54
Vue.js, PWA & The Subway Dilemma - @ianaya89 55
⚙ vue.config.js module.exports = { // ... pwa: { name:
'My App', themeColor: '#4DBA87', msTileColor: '#000000', appleMobileWebAppCapable: 'yes', appleMobileWebAppStatusBarStyle: 'black' } // ... } Vue.js, PWA & The Subway Dilemma - @ianaya89 56
Vue.js, PWA & The Subway Dilemma - @ianaya89 57
workbox-webpack-plugin Vue.js, PWA & The Subway Dilemma - @ianaya89 58
! Workbox !" GenerateSW Vue.js, PWA & The Subway Dilemma
- @ianaya89 59
! Workbox ! InjectManifest Vue.js, PWA & The Subway Dilemma
- @ianaya89 60
⚙ vue.config.js module.exports = { pwa: { name: 'My App',
themeColor: '#4DBA87', msTileColor: '#000000', appleMobileWebAppCapable: 'yes', appleMobileWebAppStatusBarStyle: 'black', // configure the workbox plugin workboxPluginMode: 'InjectManifest', workboxOptions: { swSrc: 'dev/sw.js', // ...other Workbox options } } } Vue.js, PWA & The Subway Dilemma - @ianaya89 61
sw.js // Cache first workbox.routing.registerRoute( new RegExp('/images/') new workbox.strategies.StaleWhileRevalidate() )
Vue.js, PWA & The Subway Dilemma - @ianaya89 62
sw.js // Network first workbox.routing.registerRoute( new RegExp('/posts/'), new workbox.strategies.NetworkFirst() )
Vue.js, PWA & The Subway Dilemma - @ianaya89 63
sw.js // Network only workbox.routing.registerRoute( new RegExp('/auth/'), new workbox.strategies.NetworkOnly() )
Vue.js, PWA & The Subway Dilemma - @ianaya89 64
㿃 Background Sync const syncQueue = new workbox.backgroundSync.Plugin('syncQueue', {}) workbox.routing.registerRoute(
/\/api\/.*\/*.json/, new workbox.strategies.NetworkOnly({ plugins: [syncQueue] }), 'POST' ); Vue.js, PWA & The Subway Dilemma - @ianaya89 65
! register-service-worker register(`${process.env.BASE_URL}service-worker.js`, { ready () {}, cached () {},
updated () {}, offline () {}, error (error) {} }) Vue.js, PWA & The Subway Dilemma - @ianaya89 66
Vue.js, PWA & The Subway Dilemma - @ianaya89 67
! Code Spli*ng Vue.js, PWA & The Subway Dilemma -
@ianaya89 68
! Async Components <script> // import Modal from './components/Modal' const
Modal = () => import( /* webpackChunkName: "modal" */ './components/Modal' ) export default { components: { Modal } } </script> Vue.js, PWA & The Subway Dilemma - @ianaya89 69
! Async Components import Router from 'vue-router' import Home from
'./views/Home.vue' export default new Router({ routes: [ { path: '/', name: 'home', component: Home }, { path: '/about', name: 'about', component: () => import(/* webpackChunkName: "about" */ './views/About.vue') } ] }) Vue.js, PWA & The Subway Dilemma - @ianaya89 70
! Async Components import Router from 'vue-router' import Home from
'./views/Home.vue' export default new Router({ routes: [ { path: '/', name: 'home', component: Home }, { path: '/about', name: 'about', component: () => import(/* webpackChunkName: "about" */ './views/About.vue') } ] }) Vue.js, PWA & The Subway Dilemma - @ianaya89 71
"There are only two hard things in Computer Science: cache
invalida:on and naming things." -- Phil Karlton Vue.js, PWA & The Subway Dilemma - @ianaya89 72
! Test Locally $ npm i -g serve $ npm
run build $ serve -s dist Vue.js, PWA & The Subway Dilemma - @ianaya89 73
Vue.js, PWA & The Subway Dilemma - @ianaya89 74
! Lighthouse Vue.js, PWA & The Subway Dilemma - @ianaya89
75
✅ Checklist • Offline Support • All browsers • Any
context • Be7er Resources = Be7er UX • HTTPS Vue.js, PWA & The Subway Dilemma - @ianaya89 76
✅ Checklist • Installable • Metadata • Fast ini/al load
• Fluid • 1 page = 1 URL Vue.js, PWA & The Subway Dilemma - @ianaya89 77
⛰ Vue.js, PWA & The Subway Dilemma - @ianaya89 78
! Resources • workbox • serviceworke.rs • lighthouse • pwastats.com
Vue.js, PWA & The Subway Dilemma - @ianaya89 79
! If it has 4 legs is PWA Vue.js, PWA
& The Subway Dilemma - @ianaya89 80
! Thanks! ! Ques&ons? ! @ianaya89 Vue.js, PWA & The
Subway Dilemma - @ianaya89 81