3 ms·
You have to be careful with this though. The static site hosts mentioned provide "atomic deploys" which means that old assets will be removed from the live site
by kevincox 3y ago
You have to be careful with this though. The static site hosts mentioned provide "atomic deploys" which means that old assets will be removed from the live site when the next deploy happens. This means that users requesting a hashed file name after the next deployment happens will be greeted with a 404. So your choice with these providers is to pick between a stale asset or a 404. In many cases a stale asset is preferable (especially for fonts and CSS which are typically at least mostly compatible between updates). And if you aren't hashing your assets then you will want to keep the revalidation behaviour (or at least keep the cache time short).
This gets much worse if you do any sort of lazy loading such as images that get loaded as the user scrolls or client-side routing which loads the next page dynamically using a hashed script file.
I wrote a blog post about these problems a while ago: https://kevincox.ca/2021/08/24/atomic-deploys/ https://kevincox.ca/2021/08/24/atomic-deploys/