{"action":"created","issue":{"url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/477","labels_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/477/labels{/name}","comments_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/477/comments","events_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/477/events","html_url":"https://github.com/mileszs/wicked_pdf/pull/477","id":124193701,"number":477,"title":"Embed JavaScript in Base64 encoded form","user":{"login":"thomasfedb","id":193831,"avatar_url":"https://avatars.githubusercontent.com/u/193831?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasfedb","html_url":"https://github.com/thomasfedb","followers_url":"https://api.github.com/users/thomasfedb/followers","following_url":"https://api.github.com/users/thomasfedb/following{/other_user}","gists_url":"https://api.github.com/users/thomasfedb/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasfedb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasfedb/subscriptions","organizations_url":"https://api.github.com/users/thomasfedb/orgs","repos_url":"https://api.github.com/users/thomasfedb/repos","events_url":"https://api.github.com/users/thomasfedb/events{/privacy}","received_events_url":"https://api.github.com/users/thomasfedb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-29T10:47:02Z","updated_at":"2015-12-29T15:16:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mileszs/wicked_pdf/pulls/477","html_url":"https://github.com/mileszs/wicked_pdf/pull/477","diff_url":"https://github.com/mileszs/wicked_pdf/pull/477.diff","patch_url":"https://github.com/mileszs/wicked_pdf/pull/477.patch"},"body":"Embedding JavaScript directly in HTML using `<script>` tags can fail if the embedded JS contains certain character sequences.\r\n\r\nThis can be resolved by encoding our JS as a Base64 string and then embedding it as a data URI."},"comment":{"url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/comments/167808429","html_url":"https://github.com/mileszs/wicked_pdf/pull/477#issuecomment-167808429","issue_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/477","id":167808429,"user":{"login":"unixmonkey","id":8360,"avatar_url":"https://avatars.githubusercontent.com/u/8360?v=3","gravatar_id":"","url":"https://api.github.com/users/unixmonkey","html_url":"https://github.com/unixmonkey","followers_url":"https://api.github.com/users/unixmonkey/followers","following_url":"https://api.github.com/users/unixmonkey/following{/other_user}","gists_url":"https://api.github.com/users/unixmonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/unixmonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unixmonkey/subscriptions","organizations_url":"https://api.github.com/users/unixmonkey/orgs","repos_url":"https://api.github.com/users/unixmonkey/repos","events_url":"https://api.github.com/users/unixmonkey/events{/privacy}","received_events_url":"https://api.github.com/users/unixmonkey/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T15:16:04Z","updated_at":"2015-12-29T15:16:04Z","body":"I don't think `wicked_pdf_asset_base64` is quite ready for this, as it doesn't cover all the edge cases that `read_asset` does, and this would break quite a few apps out there.\r\n\r\nYou can use `wicked_pdf_asset_base64` in your apps today like this:\r\n```html\r\n<%= stylesheet_link_tag(wicked_pdf_asset_base64('pdf.css')) %>\r\n<%= javascript_include_tag(wicked_pdf_asset_base64('somefile.js')) %>\r\n<%= image_tag(wicked_pdf_asset_base64('foo.png')) %>\r\n```\r\n\r\nAs long as your asset is actually part of the asset pipeline, and can be found with `Rails.application.assets.find_asset('somefile.js')`.\r\nThe goal right now is to make `wicked_pdf_asset_base64` work with files in /public, as well as assets hosted on a CDN.\r\n\r\nThis might be as simple as swapping in `read_asset` inside `wicked_pdf_asset_base64`, but I could use help testing that out in various scenarios to make sure it doesn't break anything for those that upgrade this gem. Any help there would be very much appreciated."}}