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
js/css: use fingerprinting to avoid using stale cached copies
When the JavaScript or CSS files are updated, caching rules often
prevent the new versions from being picked up, whether due to
browser-side caching or server-side caching.
Let's avoid this by fingerprinting the files as described in
https://gohugo.io/functions/resources/fingerprint/. We are technically
not even interested in the cryptographic aspect of this, the only
benefit we are looking for is that the file _names_ change in a
predictable manner based on the file _contents_ (similar to how Git
objects work...).
While we are technically not interested in the cryptographic aspect, we
can just as well benefit from it by adding the corresponding `integrity`
attribute. However, we only do that if the base URL indicates that this
will be accessed via HTTPS; Otherwise loading the pages locally via
`file:///` would no longer work for those resources (see
https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
for more information about this issue).
Inspired-by: Toon Claes <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
0 commit comments