sw-precache
sw-precache copied to clipboard
Question: Is it possible to cache templates outside of the root?
I have this folder structure:
- templates
- www
- assets
- service-worker.js
- index.php
Because I use a CMS my templates are in the templates folder outside my root, is there a way to just cache http requests, some sort of crawling urls?
export function generateServiceWorker(done) {
const swPrecache = require('sw-precache');
const rootDir = 'www';
swPrecache.write(`${rootDir}/service-worker.js`, {
staticFileGlobs: [rootDir + '/assets/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff}' ,'/agenda/', '/'],
stripPrefix: rootDir
}, done);
}
This works fine for my assets but not for my home (/) and agenda (/agenda/ ) urls. I can't find any clear articles or issues about this.