googlearchive / workbox-microsite

Workbox Microsite
Apache License 2.0
24 stars 13 forks source link

.html extension stripping issues #55

Closed jeffposnick closed 7 years ago

jeffposnick commented 7 years ago

We went with the decision that the non-.html version of our URLs would be authoritative, and have a HTTP 301 redirect from .html to non-.html enforced by our Firebase config: https://github.com/GoogleChrome/workbox-microsite/blob/master/firebase.json#L4

There are a couple of things we could improve about the site to account for this:

Or.... we could just turn off the setting in the Firebase config that enables the non-.html 301 redirects, and not really have to change anything else.

gauntface commented 7 years ago

Most of this is easy and done in branch ref-docs-html.

I'm not a fan of the templatedUrls simply because I'm assuming we'll have to do a templatedUrl for every entry and this feels like a common enough thing that it shouldn't be so difficult.

We could a callback function that allows a developer to intercept final precache options (i.e. the filename and the revision) and let them alter and return the value and that's what get's used in the service worker.

This can be considered a last resort for developers wanting to add some custom logic / behavior to the files precache list.

jeffposnick commented 7 years ago

Seeing up templatedUrls can be automated via glob() + array manipulation, which is kinda-sorta like a callback, but one at build time.

It sounds like you're suggesting a runtime callback, which would be a good alternative, if the API surface is clear enough.