io2015-codelabs
io2015-codelabs copied to clipboard
sw-precache gulpfile.js
gulp.task('generate-service-worker', function(callback) {
var path = require('path');
var swPrecache = require('sw-precache');
var rootDir = 'app';
swPrecache.write(path.join(rootDir, 'sw.js'), {
staticFileGlobs: [rootDir + '/**/*.{js,html,css,png,jpg,gif,mp3}'],
stripPrefix: rootDir
}, callback);
});
Should Add mp3 to the staticFileGlobs, otherwise in offline won't hear the noise.
Yes, please add the staticFileGlobs: [rootDir + '/**/*.{js,html,css,png,jpg,gif,mp3,wav}'],