I want to let hugo
automatically create SRI for a remote resource fetched via URL, e.g.:
{{ $js := resources.Get "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" }}
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
This works great with latest hugo v0.90.0-DEV+extended
.
Any ideas on how to make that work with current hugo 0.89.x
or earlier versions? I know I can store the .js file locally in the assets
folder, but that’s not what I want.