jekyll-purgecss
jekyll-purgecss copied to clipboard
Generate SRI Hash (integrity) after purging CSS
I'm using jekyll-assets in my project. It generates the SRI Hash and adds it as the value of the integrity attribute of the link tag for the CSS in the HTML.
However, after jekyll-purgecss runs, the integrity value doesn't match the hash of the purged CSS anymore, and the browser doesn't load the CSS file at all.
I can turn off integrity in the jekyll-assets as a workaround, but I was wondering if there's a way to regenerate the SRI Hash after running the purge.
Hi,
Do you also use postcss? I also created a jekyll-postcss plugin that can run purgecss, but does so during the ”converter” stage of the jekyll lifecycle.
If you use purge css with that plugin, the jekyll assets plugin will most likely work.
Other than that, I’d have to do more investigation.
@mhanberg Thanks for your help. I'll try it out soon and update this thread.
I also noticed that when I deploy my site to Netlify, the CSS is not purged, even though I have the JEKYLL_ENV set to production in my deploy settings. It does download this plugin. I can see a line Using jekyll-purgecss 0.3.0 in the deployment output. It works fine on my localhost (except for the SRI Hash issue). I've reported this as a new issue: https://github.com/mhanberg/jekyll-purgecss/issues/11