This twig filter would take in path to specific file, and output it with GET parameter, consisting of file modification time (timestamp).
Each time file would change, GET parameter would also change. Ideal for browser cache busting.
For example this:
<script src="{{'scripts/script.js'|updateFile}}"></script>
Outputs:
<script src="scripts/script.js?v=1234556789990"></script>
The filter would also need to know the file鈥檚 server path in order to know its modify time.
Andr茅 Elvan's Stamp plugin works marvelously for accomplish exactly this.
I second this FR, but instead of using the modified time, maybe using a hash?
Most helpful comment
Andr茅 Elvan's Stamp plugin works marvelously for accomplish exactly this.