experiments

All kinds of coding experiments
Log | Files | Refs | Submodules

generator.js (441B)


      1 const workbox = require('workbox-build')
      2 
      3 workbox.generateSW({
      4     cacheId: 'example_pwa',
      5     globDirectory: './',
      6     globPatterns: [
      7         '**/*.{css|js}'
      8     ],
      9     swDest: './sw.js',
     10     runtimeCaching: [{
     11         urlPattern: /\.(?:css|html)$/,
     12         handler: 'StaleWhileRevalidate',
     13         options: {
     14             cacheName: 'markup',
     15             expiration: {
     16                 maxAgeSeconds: 3600,
     17             }
     18         }
     19     }]
     20 })