CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
489 stars 53 forks source link

Cache busting #149

Closed JonoB closed 10 years ago

JonoB commented 10 years ago

Unless I have missed something, I don't see any cache busting mechanism.

If css is always compiled to application.css and js to application.js, then how does the browser know that something has changed? It will just continue loading the old version unless the user manually clears their browser cache (which of course doesn't happen).

You either need to create a unique file name, or you need to append a query string. In most cases this is just the last changed file timestamp. So, it becomes something like 1394803572.css or application.css?t=1394803572

Again...perhaps I've missed how this package does cache busting.

kdocki commented 10 years ago

Browsers will send a header HTTP_IF_MODIFIED_SINCE ... which we check for.

https://github.com/CodeSleeve/asset-pipeline/blob/master/src/Codesleeve/AssetPipeline/Filters/ClientCacheFilter.php#L87

kdocki commented 10 years ago

https://github.com/CodeSleeve/asset-pipeline/issues/154