{"action":"created","issue":{"url":"https://api.github.com/repos/ratpack/ratpack/issues/397","labels_url":"https://api.github.com/repos/ratpack/ratpack/issues/397/labels{/name}","comments_url":"https://api.github.com/repos/ratpack/ratpack/issues/397/comments","events_url":"https://api.github.com/repos/ratpack/ratpack/issues/397/events","html_url":"https://github.com/ratpack/ratpack/issues/397","id":38853621,"number":397,"title":"Provide a service that provides checksums of content in the base dir (for cache busting of asset serving)","user":{"login":"alkemist","id":17825,"avatar_url":"https://avatars.githubusercontent.com/u/17825?v=3","gravatar_id":"","url":"https://api.github.com/users/alkemist","html_url":"https://github.com/alkemist","followers_url":"https://api.github.com/users/alkemist/followers","following_url":"https://api.github.com/users/alkemist/following{/other_user}","gists_url":"https://api.github.com/users/alkemist/gists{/gist_id}","starred_url":"https://api.github.com/users/alkemist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alkemist/subscriptions","organizations_url":"https://api.github.com/users/alkemist/orgs","repos_url":"https://api.github.com/users/alkemist/repos","events_url":"https://api.github.com/users/alkemist/events{/privacy}","received_events_url":"https://api.github.com/users/alkemist/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ratpack/ratpack/labels/good-first-contrib","name":"good-first-contrib","color":"00c5fe"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2014-07-27T23:42:56Z","updated_at":"2015-01-05T19:48:37Z","closed_at":null,"body":"Not sure whether there should be methods on `FileSystemBinding` that instead of returning a `Path` return some kind of hash, or whether this should be a standalone service that takes a `Path` and returns a hash.\n\nThe general idea would be that this service could be used when generating HTML with links to assets to include the hash as a query param, which would allow eternal caching of such URLs because the URL will change when the content changes."},"comment":{"url":"https://api.github.com/repos/ratpack/ratpack/issues/comments/68765144","html_url":"https://github.com/ratpack/ratpack/issues/397#issuecomment-68765144","issue_url":"https://api.github.com/repos/ratpack/ratpack/issues/397","id":68765144,"user":{"login":"zedar","id":173854,"avatar_url":"https://avatars.githubusercontent.com/u/173854?v=3","gravatar_id":"","url":"https://api.github.com/users/zedar","html_url":"https://github.com/zedar","followers_url":"https://api.github.com/users/zedar/followers","following_url":"https://api.github.com/users/zedar/following{/other_user}","gists_url":"https://api.github.com/users/zedar/gists{/gist_id}","starred_url":"https://api.github.com/users/zedar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zedar/subscriptions","organizations_url":"https://api.github.com/users/zedar/orgs","repos_url":"https://api.github.com/users/zedar/repos","events_url":"https://api.github.com/users/zedar/events{/privacy}","received_events_url":"https://api.github.com/users/zedar/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T19:48:37Z","updated_at":"2015-01-05T19:48:37Z","body":"Fully agree. Asset-pipeline does the work with minification, concatenation,\r\ndigesting. But please have a look at how Luc defined the issue:\r\n\r\n   1. A generic service for getting checksums of file system content\r\n   (integrated into supported templating engines)\r\n   2. User configuration/specification of the checksumming strategy to use\r\n\r\nI've implemeneted first point. The second one is ongoing.​\r\nBTW, in current implementation checksum is generated only once, while\r\ntemplate (groovy markup, handlebars, thymeleaf) is processed and HTML is\r\nreturned.\r\nFor now I do not check if checksum included in parameter equals to file\r\nchecksum. But it is quite easy to implement.\r\n\r\nWould be good to agree with Luc what we do in ratpack-core and what should\r\nwe leave for asset-pipeline.\r\n\r\nOn 5 January 2015 at 19:46, David Estes <notifications@github.com> wrote:\r\n\r\n> The entire point of this feature (I assume this is correct) Is to ensure\r\n> proper cache busting for serving your assets. You want to send the cache\r\n> digested name with a really long cache expiration or No-Expire. And if the\r\n> file change the new file name simply changes. In real world scenarios with\r\n> a CDN this is great because if you do a backend rolling deploy and a web\r\n> request hits both servers during a request cycle . Both versions of your\r\n> changed client side asset still exists which can make a rolling restart\r\n> scenario a lot smoother for users that launch your website/app in the\r\n> middle of it. The problem is, if you do not process CSS files as well and\r\n> their individual @import or image url statements. The entire point of the\r\n> cache busting digest is kinda lost. Its an incomplete cache bust. Which can\r\n> actually cause all sorts of weirdness in certain situations. This is why\r\n> the asset-pipeline has a processor that runs on css files and sass and less\r\n> files at the end.\r\n> https://github.com/bertramdev/asset-pipeline-core/blob/master/asset-pipeline-core/src/main/groovy/asset/pipeline/processors/CssProcessor.groovy\r\n> . This processor serves 2 purposes. It recalculates a relative path during\r\n> the bundling process, and when its passed an AssetCompiler class (meaning\r\n> its preparing a file for final compilation in a production style\r\n> environment). It ensures the url is replaced with a cache digested name of\r\n> the file.\r\n>\r\n> —\r\n> Reply to this email directly or view it on GitHub\r\n> <https://github.com/ratpack/ratpack/issues/397#issuecomment-68754914>.\r\n>"}}