CACHE headers and busting technique in jekyll


#1

is there a way to set cache headers and use cache busting techniques in jekyll?


#2

I’ve seen cache busting techniques that use gulp - and would highly recommend using gulp with jekyll to handle as much as possible as it is much quicker.


#3

It’s simple, but I presume something like this might do the job.


#4

That’s an interesting idea, I use S3 to host so I don’t have control like you do.

Did give me the idea that I could just add a querystring to the css/js files that adds the site.date to it, and that would cache bust I think, but would change every time I build rather than every time I change the css/js.

I like your idea of using a site variable, easy enough to remember to change that when needed which is rare for me at the moment.

The Gulp way that I saw used a data file and some sort of Gulp magic to check the date modified and then change the version number if needed in the data file via Gulp.


#5

When I did this for my service worker (and Minima’s), I used one of the Liquid date functions, so no explicit querystring required. It’s a bit verbose and caching is still my enemy, but it works well enough.