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
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
週末にループ・エンジニアリングの理解を深めるためのスライド
nagatsu
0
360
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
890
40代で“やっとエンジニアになれた”――閉じた学びを開き、空の青さを知る / 20260628 Naoki Takahashi
shift_evolve
PRO
4
890
When Platform Engineering Meets GenAI
sucitw
0
180
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
520
AIのReact習熟度を測る
uhyo
2
690
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
130
AIチャット検索改善の3週間
kworkdev
PRO
2
180
從開發到部署全都交給 AI:實作 AI 驅動的自動化流程
appleboy
0
170
GitHub Copilot app最速の発信の裏側
tomokusaba
1
260
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
190
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
160
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
870
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
A better future with KSS
kneath
240
18k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
330
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
340
The Mindset for Success: Future Career Progression
greggifford
PRO
0
370
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
The untapped power of vector embeddings
frankvandijk
2
1.8k
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