Open rcmurphy opened 3 years ago
I have easily overridden this by adding
path('serviceworker.js', TemplateView.as_view(template_name='serviceworker.js', content_type='application/javascript'), name='service-worker'),
to my urls.py
(before django-pwa
).
But some kind of support from django-pwa
would be nice, since it would be common request to generate some of the filesToCache
automatically.
Having it in template with reasonable block
s defined or having it configurable some other way would also spare us a lot of code copying and duplication.
service-worker.js is in the templates directory, which would lead one to believe that they can override it. However, the file is actually loaded in directly as a plain file. Would you be open to a PR to change the behavior to use template based loading? With caching, the performance difference would be non-existent after the first request, and it would allow for some more powerful customization of the logic within that file.