CSS Cache Busting with your Git Commit SHA
When not using MIX and its versions
Last updated
Was this helpful?
When not using MIX and its versions
Last updated
Was this helpful?
Now that Tailwind CSS has JIT mode, I have stopped configuring and using laravel mix.
A useful feature of mix is cache busting - the ability to force your users to reload css and js files from the server instead of using their cached versions
A simple way to add cache busting to your css loads is to use your Git commit sha hash as a parameter on the css line.
This article describes how you can get the Git sha hash in your application;
Add the sha to your css load;
This generates a line in your browser like;
where `f7509a3` is the sha hash of your code and will change on each commit.