Assets with query string


In my projet, we use a CDN/reverse proxy cache.

Right now, my assets looks like: "/js/custom.js". However, if I update this file, the cache must be invalidated in CDN (on cloudfront it can take few hours...).

We can use a tip, use the filemtime (timestamp format) as query string. Like: "/js/custom.js?1498555509". If i update my js file, the HTML generates a new timestamp.

I tried to hack Phalcon\Assets\Manager and Phalcon\Assets\Collection. But i don't like my code (too dirty). Anyone found a good a way?


It should be fairly easy. I don't have access to the project at the moment, but surely I remember we did something KISS with it, so in the end our assets looked like style.css?v=1.2.

What is your (dirty) solution?