grav-learn
grav-learn copied to clipboard
Document how asset timestamps are calculated
I really like the fact that Grav can add timestamps to assets, it's the kind of thing that makes your life a lot easier as a developer! However, until just recently, I was under the impression that these timestamps were updated when the timestamps were updated in a manner similar to how the page caching mechanism works. But it looks like this wasn't the case, and timestamps are actually just a random string generated by Grav when the cache is cleared.
It would be great to have the timestamps update automatically, but more than anything, we need some documentation on how the timestamp mechanism works.
The timestamps are not calculated for each file because it would take time, and some files may not be local and therefore would be impossible to get a modified time for. We use a random number triggered by the cache so that you can easily ensure that new files are picked with a new timestamp up by simply clearing the cache. I think this is a little too technical for our docs frankly, but feel free to submit a PR if you can find an appropriate location for this information.
Great, I'll try and submit a PR for it as soon as I get around to it!
Regarding what you said about the level of techincal detail – I just want to throw it in there, that while Grav aims to have a low barrier of entry, there will always be people building themes or plugins that value technical detail in the documentation. The existing sections in the docs divide things in a way that makes it fairly clear what user group each section caters to – but I think that the advanced section deserves a bit of love. Grav's API's and concepts are great, but the ins and outs of building a custom site aren't all that clearly documented
@rhukster I'm coming back to this now and wondering if it wouldn't make more sense to make the asset query string clearable by clearing the asset cache? It's a bit drastic in a way to have to clear out cached image operations and everything just to get a new query string for the JS/CSS.