I wanted to have a simple plugin adding subresource integrity hashes to <link> and <script> tags for safer CDN usage (eg, in combination with Kirby’s official cdn-plugin).
I quickly ended up with a plugin (source) and some promising results. It’s based on Kirby’s CSS / JS components, except for two things:
… which is then called to output a proper hash for the file being processed:
3. Question:
Now, what I want to achieve is the following:
Get the SRI hash (like shown above) and then passing it to the $attr array of all options that are passed to the corresponding css/js html::tag, like so:
BUT what I couldn’t figure out was, how to do it in a fashion that I don’t have to repeat / incorporate techniques from other cache-bust plugins (like cachebuster by @bastianallgeier and @lukasbestle or aforementioned kirby-fingerprint by @iksi), but BUILDING ON whatever people have installed - well, applying my function to whatever CSS/JS class is being used (vanilla or modified).
Thus, I call upon thee, mighty gods of Kirby forum (to my knowledge, the only ones I haven’t mentioned so far are @jenstornell and of course @texnixe).
And thank you for making Kirby the great software it is.