How to calculate SRI for template static js?


I’m using airspace-hugo theme. In config’s plugin section, there are plugin URL defined, such as:

[[params.plugins.js]] link = "plugins/jQuery/jquery.min.js"

The template then iterates over them to add script tags:

<!-- JS Plugins --> {{ range site.Params.plugins.js }} <script src="{{ .link | relURL }}"></script> {{ end }}

I’m trying to call resources.Get on them and calculate resources.Fingerprint "sha512" but error says that Fingerprint cannot operate on value. I think the problem is that resources.Get doesn’t really read the file from static directory but assets. I’ve tried using …/static trick but it doesn’t work.

What would be the correct way to access theme static files in that way?

move it to /assets

You could also, technically, mount a given folder both to static and assets.