You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow to reference compressed hashes by compress name for later use.
Apart from #1032, I have another use-case for this: I would like to construct servicesworker.js for Progressive web app (https://github.com/silviolleite/django-pwa) with compressed scripts.
Copying the exact content of the compress tag is very inconvenient and will lead to bugs in the future, when I will fail to change the content at all places.
Although this might not be possible to achieve for online compression at all (or would be very difficult), for offline compression it is quite easily - we just need to store the name references in offline compress manifest or some other file.
I was even able to get the info from the current manifest.json (although it is a bit hacky and might not work at all times, because I use regexps to find the appropriate <script> tags. Here is my code for the compress_reference templatetag:
Allow to reference compressed hashes by compress name for later use.
Apart from #1032, I have another use-case for this: I would like to construct
servicesworker.js
for Progressive web app (https://github.com/silviolleite/django-pwa) with compressed scripts.Copying the exact content of the
compress
tag is very inconvenient and will lead to bugs in the future, when I will fail to change the content at all places.Although this might not be possible to achieve for online compression at all (or would be very difficult), for offline compression it is quite easily - we just need to store the name references in offline compress manifest or some other file.
I was even able to get the info from the current
manifest.json
(although it is a bit hacky and might not work at all times, because I use regexps to find the appropriate<script>
tags. Here is my code for thecompress_reference
templatetag:I use it in my service worker this way:
(edit: I added fix for CSS styles to the templatetag code)
(edit1: de-duplicate the lists)
The text was updated successfully, but these errors were encountered: