Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service-worker.js loading is Unconventional #73

Open
rcmurphy opened this issue May 28, 2021 · 1 comment
Open

service-worker.js loading is Unconventional #73

rcmurphy opened this issue May 28, 2021 · 1 comment

Comments

@rcmurphy
Copy link

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.

@PetrDlouhy
Copy link

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 blocks defined or having it configurable some other way would also spare us a lot of code copying and duplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants