Access "jekyll-assets" hash digests via Liquid


#1

Hi all!

I’m using the jekyll-assets plugin to bundle my site assets and refer to them via a CDN url, which is working well! However I am using Content Security Policy on my site, and I would like to be able to whitelist the files individually by referring to their hash values, rather than whitelisting the entire CDN domain.

Since jekyll-assets already knows the hash of this file (it calculates one for cache-busting reasons in the output filename and uses a different one for Sub-Resource Integrity), can I get access to this hash (ideally a SHA256 hash!) through the use of Liquid so that I can update the .htaccess/web.config/whatever file to change my CSP headers as the site.js and site.css files evolve?

TL;DR: I’d love to access each file’s SHA256 hash via Liquid preprocessing template tags, in much the same way you can already access properties like the already documented and supplied properties like filename and basepath and whatnot. Is this possible?

Thanks so much for your help!


#2

Hey @MattCotterellNZ,

Please file a ticket at https://github.com/jekyll/jekyll-assets and we’ll add it.

Thanks!