diff --git a/lighthouse-viewer/app/index.html b/lighthouse-viewer/app/index.html
index ee47e6f09d78..1199fac8cac9 100644
--- a/lighthouse-viewer/app/index.html
+++ b/lighthouse-viewer/app/index.html
@@ -20,8 +20,8 @@
Lighthouse Report Viewer
+
-
diff --git a/lighthouse-viewer/app/images/manifest.json b/lighthouse-viewer/app/manifest.json
similarity index 65%
rename from lighthouse-viewer/app/images/manifest.json
rename to lighthouse-viewer/app/manifest.json
index b8af0ec723c5..62954130abb2 100644
--- a/lighthouse-viewer/app/images/manifest.json
+++ b/lighthouse-viewer/app/manifest.json
@@ -3,17 +3,18 @@
"short_name": "Lighthouse",
"icons": [
{
- "src": "android-chrome-192x192.png",
+ "src": "images/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
- "src": "android-chrome-512x512.png",
+ "src": "images/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#304ffe",
"background_color": "#304ffe",
- "display": "standalone"
+ "display": "standalone",
+ "start_url": "./"
}
diff --git a/lighthouse-viewer/app/src/main.js b/lighthouse-viewer/app/src/main.js
index a86071e2089b..e7346b60412b 100644
--- a/lighthouse-viewer/app/src/main.js
+++ b/lighthouse-viewer/app/src/main.js
@@ -43,3 +43,7 @@ Promise.all(loadPolyfillPromises).then(_ => {
// eslint-disable-next-line no-new
new LighthouseViewerReport();
});
+
+if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('sw.js');
+}
diff --git a/lighthouse-viewer/app/sw.js b/lighthouse-viewer/app/sw.js
new file mode 100644
index 000000000000..d2b526f3ca0d
--- /dev/null
+++ b/lighthouse-viewer/app/sw.js
@@ -0,0 +1,18 @@
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Intentionally empty for now.
diff --git a/lighthouse-viewer/gulpfile.js b/lighthouse-viewer/gulpfile.js
index cf31b3f5cabb..2b04aa5200a8 100644
--- a/lighthouse-viewer/gulpfile.js
+++ b/lighthouse-viewer/gulpfile.js
@@ -38,7 +38,8 @@ function license() {
gulp.task('lint', () => {
return gulp.src([
'app/src/**/*.js',
- 'gulpfile.js'
+ 'gulpfile.js',
+ 'sw.js'
])
.pipe($.eslint())
.pipe($.eslint.format())
@@ -65,7 +66,11 @@ gulp.task('concat-css', ['html', 'css'], () => {
});
gulp.task('html', () => {
- return gulp.src('app/*.html').pipe(gulp.dest(DIST_FOLDER));
+ return gulp.src([
+ 'app/*.html',
+ 'app/sw.js',
+ 'app/manifest.json'
+ ]).pipe(gulp.dest(DIST_FOLDER));
});
gulp.task('polyfills', () => {
@@ -124,7 +129,9 @@ gulp.task('watch', ['lint', 'browserify', 'polyfills', 'html', 'images', 'css'],
});
gulp.watch([
- 'app/index.html'
+ 'app/index.html',
+ 'app/manifest.json',
+ 'app/sw.js'
]).on('change', () => {
runSequence('html');
});