{"action":"created","issue":{"url":"https://api.github.com/repos/Mange/roadie-rails/issues/11","labels_url":"https://api.github.com/repos/Mange/roadie-rails/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/Mange/roadie-rails/issues/11/comments","events_url":"https://api.github.com/repos/Mange/roadie-rails/issues/11/events","html_url":"https://github.com/Mange/roadie-rails/issues/11","id":37365098,"number":11,"title":"Fully support asset_host","user":{"login":"Mange","id":1599,"avatar_url":"https://avatars.githubusercontent.com/u/1599?v=3","gravatar_id":"","url":"https://api.github.com/users/Mange","html_url":"https://github.com/Mange","followers_url":"https://api.github.com/users/Mange/followers","following_url":"https://api.github.com/users/Mange/following{/other_user}","gists_url":"https://api.github.com/users/Mange/gists{/gist_id}","starred_url":"https://api.github.com/users/Mange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mange/subscriptions","organizations_url":"https://api.github.com/users/Mange/orgs","repos_url":"https://api.github.com/users/Mange/repos","events_url":"https://api.github.com/users/Mange/events{/privacy}","received_events_url":"https://api.github.com/users/Mange/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Mange/roadie-rails/milestones/1","labels_url":"https://api.github.com/repos/Mange/roadie-rails/milestones/1/labels","id":704192,"number":1,"title":"Version 1.1","description":"First feature release in the 1.x series","creator":{"login":"Mange","id":1599,"avatar_url":"https://avatars.githubusercontent.com/u/1599?v=3","gravatar_id":"","url":"https://api.github.com/users/Mange","html_url":"https://github.com/Mange","followers_url":"https://api.github.com/users/Mange/followers","following_url":"https://api.github.com/users/Mange/following{/other_user}","gists_url":"https://api.github.com/users/Mange/gists{/gist_id}","starred_url":"https://api.github.com/users/Mange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mange/subscriptions","organizations_url":"https://api.github.com/users/Mange/orgs","repos_url":"https://api.github.com/users/Mange/repos","events_url":"https://api.github.com/users/Mange/events{/privacy}","received_events_url":"https://api.github.com/users/Mange/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2014-06-28T09:45:41Z","updated_at":"2015-01-13T13:47:12Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2014-07-08T12:32:54Z","updated_at":"2015-01-15T07:57:09Z","closed_at":null,"body":"Here are my *notes* about this feature so people can contribute with ideas and feedback.\r\n\r\n**Current issues:**\r\n\r\n1. Asset host is not applied to assets that get full URLs\r\n2. When asset host is set, `stylesheet_link_tag` becomes an absolute URL and inlining will not happen\r\n\r\n## 1. Asset host is not applied\r\n\r\n* This might be out of scope.\r\n  * After all, why don't you just use `image_tag`, etc.\r\n  * Can I find any examples in the wild where it makes sense?\r\n* This will require `roadie` to be able to take a callable as `url_options`.\r\n  * Maybe this is sane anyway..? Someone might want to rewrite different kinds of paths in different ways.\r\n    * Is it easier to make `UrlRewriter` into a public interface and have people inject it instead?\r\n\r\n## 2. Does not inline `stylesheet_link_tag`s with `asset_host`\r\n\r\n* Not trivial to fix. `asset_host` can be `String`, `Array` or callable.\r\n  * `String` is easy to fix; see if full URL starts with this string and strip it.\r\n  * `Array` is also pretty easy. Do the `String` check for each item in the array.\r\n  * callable is much harder. It could be doing anything, really.\r\n    * User should provide a callable that reverses `asset_host`?\r\n    * Take a guess (`=~ %r{/assets/}`)? No. Error prone and too magic. Will break in all kinds of ways.\r\n    * Take basename of file and look for it anyway? Will break for some people that want to be able to actually link to external stylesheets that happens to have the same name as a local asset too. (\"Hey, this is why I used a full URL!\")\r\n    * Don't support this? How to communicate it? It will be seen as a \"silent error\" by most, and callable `asset_host` is a *very* common pattern.\r\n      * If `asset_host` is set to a callable, require a reversing proc or fail with an error message.\r\n        * But what about those who don't want it? They might just be after inline `<style>` elements or something. This requires them to work more.\r\n        * This error will mostly only be detected in `production`. That's a very bad experience.\r\n* Will require changes to `roadie`\r\n    * Roadie does not even ask asset providers on absolute URLs. AssetProviders need to provide a new API that can resolve absolute URLs.\r\n      * `asset_provider.find_using_url(url) if asset_provider.respond_to?(:find_using_url)` perhaps? This does not require a major version bump; old implementations work like before."},"comment":{"url":"https://api.github.com/repos/Mange/roadie-rails/issues/comments/70051228","html_url":"https://github.com/Mange/roadie-rails/issues/11#issuecomment-70051228","issue_url":"https://api.github.com/repos/Mange/roadie-rails/issues/11","id":70051228,"user":{"login":"Mange","id":1599,"avatar_url":"https://avatars.githubusercontent.com/u/1599?v=3","gravatar_id":"","url":"https://api.github.com/users/Mange","html_url":"https://github.com/Mange","followers_url":"https://api.github.com/users/Mange/followers","following_url":"https://api.github.com/users/Mange/following{/other_user}","gists_url":"https://api.github.com/users/Mange/gists{/gist_id}","starred_url":"https://api.github.com/users/Mange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mange/subscriptions","organizations_url":"https://api.github.com/users/Mange/orgs","repos_url":"https://api.github.com/users/Mange/repos","events_url":"https://api.github.com/users/Mange/events{/privacy}","received_events_url":"https://api.github.com/users/Mange/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T07:57:09Z","updated_at":"2015-01-15T07:57:09Z","body":"I'm expressing myself really bad up there. The point is that I don't want to build in support for `asset_host`-like behavior inside `roadie`, e.g. that the hostname could be semi-random. I'd like to keep `url_options` as a static hash for simplicity.\r\nIf someone would want semi-random hostnames on images, they could generate the email as such. That was the point. (It's not really possible right now due to this bug, though. But when it's fixed, I won't add similar semantics.)\r\n\r\nIs that clearer?"}}