Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

Commit deabdc1

Browse files
author
Matt Gaunt
committed
Adding in cacheID to swprecache
1 parent 4be0df7 commit deabdc1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gulp-tasks/service-worker.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
var gulp = require('gulp');
1919
var path = require('path');
20+
var fs = require('fs');
2021
var swPrecache = require('sw-precache');
2122

23+
// This is used as the cacheID, worth only reading the file once.
24+
var packageName = JSON.parse(fs.readFileSync('./package.json', 'utf8')).name;
25+
2226
gulp.task('service-worker:watch', function(cb) {
2327
gulp.watch(GLOBAL.config.src + '/**/*.*', ['service-worker']);
2428
});
@@ -36,6 +40,7 @@ gulp.task('service-worker', function(cb) {
3640
'/partials/url-2': ['server/layouts/partial.handlebars', 'server/views/url-2.handlebars'],
3741
},
3842
stripPrefix: GLOBAL.config.dest,
39-
navigateFallback: '/app-shell'
43+
navigateFallback: '/app-shell',
44+
cacheId: packageName
4045
}, cb);
4146
});

0 commit comments

Comments
 (0)