Skip to content

Instantly share code, notes, and snippets.

@attilavago
Last active January 18, 2018 22:20
Show Gist options
  • Save attilavago/1d2ee905e461380e047d852571c73971 to your computer and use it in GitHub Desktop.
Save attilavago/1d2ee905e461380e047d852571c73971 to your computer and use it in GitHub Desktop.
Gulpfile for R.O.A.S. service worker
var gulp = require('gulp');
var swPrecache = require('sw-precache');
gulp.task('generate-service-worker', function(callback) {
var rootDir = 'app';
swPrecache.write(`${rootDir}/service-worker.js`, {
staticFileGlobs: ['app/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,woff2,mp3,json}'],
maximumFileSizeToCacheInBytes: ['52428800']
}, callback);
});
gulp.task( 'default', [ 'generate-service-worker' ] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment