io2015-codelabs icon indicating copy to clipboard operation
io2015-codelabs copied to clipboard

sw-precache gulpfile.js

Open zhentian-wan opened this issue 8 years ago • 1 comments

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.

zhentian-wan avatar May 24 '16 16:05 zhentian-wan

Yes, please add the staticFileGlobs: [rootDir + '/**/*.{js,html,css,png,jpg,gif,mp3,wav}'],

nobso avatar Sep 27 '16 03:09 nobso