Skip to content

Commit

Permalink
Merge pull request #32 from google/pwa
Browse files Browse the repository at this point in the history
Turn Oodle into a PWA
  • Loading branch information
addyosmani committed May 4, 2018
2 parents f8e4e01 + e3cc0b2 commit 3b73913
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 591 deletions.
20 changes: 20 additions & 0 deletions build/webpack.prod.conf.js
Expand Up @@ -12,6 +12,7 @@ const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const ImageminPlugin = require('imagemin-webpack-plugin').default
const imageminMozjpeg = require('imagemin-mozjpeg')
const WorkboxPlugin = require('workbox-webpack-plugin')

const env = require('../config/prod.env')

Expand Down Expand Up @@ -130,6 +131,25 @@ const webpackConfig = merge(baseWebpackConfig, {
progressive: true
})
]
}),
new WorkboxPlugin.GenerateSW({
swDest: 'service-worker.js',
include: [/\.js$/, /\.html$/, /\.css$/, /\.png$/, /\.jpg$/, /\.gif$/, /\.woff2$/],
exclude: [/service-worker.*\.js/, /^precache-manifest\..+\.js/, /\.js.map$/, /\.css.map/],
clientsClaim: true,
skipWaiting: true,
runtimeCaching: [
{
// Match any request ends with .png, .jpg, .jpeg or .svg.
urlPattern: /\.(?:html|js|css|jpg|png|gif|json|woff2|mp4|webm)$/,

// Apply a cache-first strategy.
handler: 'cacheFirst'
},
{
urlPattern: new RegExp('https://fonts.(?:googleapis|gstatic|google).com/(.*)'),
handler: 'cacheFirst'
}]
})
]
})
Expand Down
12 changes: 12 additions & 0 deletions index.html
Expand Up @@ -4,6 +4,9 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="shortcut icon" href="/static/192x192.png">
<link rel="manifest" href="/static/manifest.json">
<meta name=theme-color content=#000000>
<title>Oodle</title>
<link rel="preload" href="/static/fonts/teko-v7-latin/teko-v7-latin-regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/static/fonts/montserrat-v12-latin/montserrat-v12-latin-regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
Expand Down Expand Up @@ -48,6 +51,15 @@ <h2 class="doodle-section-classic">This week
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="/static/fonts/teko.css" type="text/css">
<link rel="stylesheet" href="/static/fonts/monteserrat.css" type="text/css">
<script>
// Check that service workers are registered
if ('serviceWorker' in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js');
});
}
</script>
</body>

</html>
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -23,7 +23,8 @@
"slugify": "^1.2.9",
"vue": "^2.5.2",
"vue-mdc-adapter": "^0.14.0",
"vue-router": "^3.0.1"
"vue-router": "^3.0.1",
"workbox-webpack-plugin": "^3.2.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
Expand Down
5 changes: 5 additions & 0 deletions src/service-worker.js
@@ -0,0 +1,5 @@
workbox.core.setCacheNameDetails({prefix: "oodle-cache"});

self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
Binary file added static/img/192x192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/512x512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
203 changes: 0 additions & 203 deletions static/logos/2015/ponyexpress/ponyexpress15-3.js

This file was deleted.

202 changes: 0 additions & 202 deletions static/logos/2015/ponyexpress/ponyexpress15-4.js

This file was deleted.

180 changes: 0 additions & 180 deletions static/logos/2015/ponyexpress/ponyexpress15.js

This file was deleted.

13 changes: 9 additions & 4 deletions static/manifest.json
@@ -1,15 +1,20 @@
{
"name": "Doodle IO",
"short_name": "DoodleIO",
"name": "Oodle",
"short_name": "Oodle",
"icons": [
{
"src": "/static/img/icons/icon.png",
"src": "/static/img/192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/static/img/512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "/index.html",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#4DBA87"
"theme_color": "#000000"
}
159 changes: 158 additions & 1 deletion yarn.lock
Expand Up @@ -2145,6 +2145,12 @@ commander@~2.8.1:
dependencies:
graceful-readlink ">= 1.0.0"

common-tags@^1.4.0:
version "1.7.2"
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.7.2.tgz#24d9768c63d253a56ecff93845b44b4df1d52771"
dependencies:
babel-runtime "^6.26.0"

commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
Expand Down Expand Up @@ -3982,6 +3988,14 @@ from2@^2.1.0, from2@^2.1.1:
inherits "^2.0.1"
readable-stream "^2.0.0"

fs-extra@^4.0.2:
version "4.0.3"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd"
Expand Down Expand Up @@ -5284,6 +5298,12 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"

isemail@3.x.x:
version "3.1.2"
resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.1.2.tgz#937cf919002077999a73ea8b1951d590e84e01dd"
dependencies:
punycode "2.x.x"

isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
Expand All @@ -5309,6 +5329,14 @@ isurl@^1.0.0-alpha5:
has-to-string-tag-x "^1.2.0"
is-object "^1.0.1"

joi@^11.1.1:
version "11.4.0"
resolved "https://registry.yarnpkg.com/joi/-/joi-11.4.0.tgz#f674897537b625e9ac3d0b7e1604c828ad913ccb"
dependencies:
hoek "4.x.x"
isemail "3.x.x"
topo "2.x.x"

jpegtran-bin@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/jpegtran-bin/-/jpegtran-bin-3.2.0.tgz#f60ecf4ae999c0bdad2e9fbcdf2b6f0981e7a29b"
Expand Down Expand Up @@ -5592,7 +5620,7 @@ lodash._reevaluate@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz#58bc74c40664953ae0b124d806996daca431e2ed"

lodash._reinterpolate@^3.0.0:
lodash._reinterpolate@^3.0.0, lodash._reinterpolate@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"

Expand Down Expand Up @@ -5736,13 +5764,26 @@ lodash.template@^3.0.0:
lodash.restparam "^3.0.0"
lodash.templatesettings "^3.0.0"

lodash.template@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0"
dependencies:
lodash._reinterpolate "~3.0.0"
lodash.templatesettings "^4.0.0"

lodash.templatesettings@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz#fb307844753b66b9f1afa54e262c745307dba8e5"
dependencies:
lodash._reinterpolate "^3.0.0"
lodash.escape "^3.0.0"

lodash.templatesettings@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz#2b4d4e95ba440d915ff08bc899e4553666713316"
dependencies:
lodash._reinterpolate "~3.0.0"

lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
Expand Down Expand Up @@ -7274,6 +7315,10 @@ prettier@^1.7.0:
version "1.11.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75"

pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"

pretty-error@^2.0.2:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
Expand Down Expand Up @@ -7363,6 +7408,10 @@ punycode@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"

punycode@2.x.x:
version "2.1.0"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d"

punycode@^1.2.4, punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
Expand Down Expand Up @@ -8812,6 +8861,12 @@ to-regex@^3.0.1:
regex-not "^1.0.2"
safe-regex "^1.1.0"

topo@2.x.x:
version "2.0.2"
resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182"
dependencies:
hoek "4.x.x"

toposort@^1.0.0:
version "1.0.6"
resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.6.tgz#c31748e55d210effc00fdcdc7d6e68d7d7bb9cec"
Expand Down Expand Up @@ -9477,6 +9532,108 @@ wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"

workbox-background-sync@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-background-sync/-/workbox-background-sync-3.2.0.tgz#08d4f79fb82fb61f72fbd0359c4b616cc75612d4"
dependencies:
workbox-core "^3.2.0"

workbox-broadcast-cache-update@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-broadcast-cache-update/-/workbox-broadcast-cache-update-3.2.0.tgz#65b4d9b3d4594751ab7ce1fee905c08214118fdc"
dependencies:
workbox-core "^3.2.0"

workbox-build@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-build/-/workbox-build-3.2.0.tgz#01f4a4f6fb5a94dadd3f86d04480c84578fa1125"
dependencies:
babel-runtime "^6.26.0"
common-tags "^1.4.0"
fs-extra "^4.0.2"
glob "^7.1.2"
joi "^11.1.1"
lodash.template "^4.4.0"
pretty-bytes "^4.0.2"
workbox-background-sync "^3.2.0"
workbox-broadcast-cache-update "^3.2.0"
workbox-cache-expiration "^3.2.0"
workbox-cacheable-response "^3.2.0"
workbox-core "^3.2.0"
workbox-google-analytics "^3.2.0"
workbox-precaching "^3.2.0"
workbox-range-requests "^3.2.0"
workbox-routing "^3.2.0"
workbox-strategies "^3.2.0"
workbox-streams "^3.2.0"
workbox-sw "^3.2.0"

workbox-cache-expiration@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-cache-expiration/-/workbox-cache-expiration-3.2.0.tgz#a585761fd5438e439668afc6f862ac5a0ebca1a8"
dependencies:
workbox-core "^3.2.0"

workbox-cacheable-response@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-cacheable-response/-/workbox-cacheable-response-3.2.0.tgz#1d8e3d437d60fb80d971d79545bb27acf1fe7653"
dependencies:
workbox-core "^3.2.0"

workbox-core@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-core/-/workbox-core-3.2.0.tgz#d1bd4209447f5350d8dd6b964c86f054c96ffa0a"

workbox-google-analytics@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-google-analytics/-/workbox-google-analytics-3.2.0.tgz#1005bc71ae03a8948b687896235dafecb1696c46"
dependencies:
workbox-background-sync "^3.2.0"
workbox-core "^3.2.0"
workbox-routing "^3.2.0"
workbox-strategies "^3.2.0"

workbox-precaching@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-precaching/-/workbox-precaching-3.2.0.tgz#36568687a5615d8bd4191b38cf0f489a992d7bbc"
dependencies:
workbox-core "^3.2.0"

workbox-range-requests@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-range-requests/-/workbox-range-requests-3.2.0.tgz#5d6cc3621cef0951fc9c0549053f8e117736d321"
dependencies:
workbox-core "^3.2.0"

workbox-routing@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-routing/-/workbox-routing-3.2.0.tgz#6aef7622ede2412dd116231f4f9408a6485a4832"
dependencies:
workbox-core "^3.2.0"

workbox-strategies@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-strategies/-/workbox-strategies-3.2.0.tgz#6cd5f00739764872b77b4c3766a606e43eb7d246"
dependencies:
workbox-core "^3.2.0"

workbox-streams@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-streams/-/workbox-streams-3.2.0.tgz#cac0e4f5693b5e13029cbd7e5fec4eb7fcb30d97"
dependencies:
workbox-core "^3.2.0"

workbox-sw@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-sw/-/workbox-sw-3.2.0.tgz#ccda9adff557ba2233bf1837229144b4a86276cb"

workbox-webpack-plugin@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/workbox-webpack-plugin/-/workbox-webpack-plugin-3.2.0.tgz#eab74294e88d86f4356a5dbac98cd803b22142b3"
dependencies:
json-stable-stringify "^1.0.1"
workbox-build "^3.2.0"

worker-farm@^1.5.2:
version "1.6.0"
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0"
Expand Down

0 comments on commit 3b73913

Please sign in to comment.