{"action":"created","issue":{"url":"https://api.github.com/repos/wvuweb/cleanslate-cms/issues/163","labels_url":"https://api.github.com/repos/wvuweb/cleanslate-cms/issues/163/labels{/name}","comments_url":"https://api.github.com/repos/wvuweb/cleanslate-cms/issues/163/comments","events_url":"https://api.github.com/repos/wvuweb/cleanslate-cms/issues/163/events","html_url":"https://github.com/wvuweb/cleanslate-cms/issues/163","id":82560533,"number":163,"title":"Add async and defer attributes to r:include_javascript","user":{"login":"adamjohnson","id":575865,"avatar_url":"https://avatars.githubusercontent.com/u/575865?v=3","gravatar_id":"","url":"https://api.github.com/users/adamjohnson","html_url":"https://github.com/adamjohnson","followers_url":"https://api.github.com/users/adamjohnson/followers","following_url":"https://api.github.com/users/adamjohnson/following{/other_user}","gists_url":"https://api.github.com/users/adamjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjohnson/subscriptions","organizations_url":"https://api.github.com/users/adamjohnson/orgs","repos_url":"https://api.github.com/users/adamjohnson/repos","events_url":"https://api.github.com/users/adamjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/adamjohnson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wvuweb/cleanslate-cms/labels/feature%20request","name":"feature request","color":"009800"},{"url":"https://api.github.com/repos/wvuweb/cleanslate-cms/labels/Q4%20delivery","name":"Q4 delivery","color":"bfdadc"}],"state":"open","locked":false,"assignee":{"login":"nreckart","id":14725,"avatar_url":"https://avatars.githubusercontent.com/u/14725?v=3","gravatar_id":"","url":"https://api.github.com/users/nreckart","html_url":"https://github.com/nreckart","followers_url":"https://api.github.com/users/nreckart/followers","following_url":"https://api.github.com/users/nreckart/following{/other_user}","gists_url":"https://api.github.com/users/nreckart/gists{/gist_id}","starred_url":"https://api.github.com/users/nreckart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nreckart/subscriptions","organizations_url":"https://api.github.com/users/nreckart/orgs","repos_url":"https://api.github.com/users/nreckart/repos","events_url":"https://api.github.com/users/nreckart/events{/privacy}","received_events_url":"https://api.github.com/users/nreckart/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-05-29T19:48:48Z","updated_at":"2015-06-23T19:16:45Z","closed_at":null,"body":"Currently there's no way to specify `defer` or `async` for an `<r:include_javascript />` tag. Async and defer can help perceived performance of your site by not preventing HTML render. Here's some ideas about how to include those in a CleanSlate template:\r\n\r\n```html\r\n<r:include_javascript name=\"example\" async />\r\n<!-- or -->\r\n<r:include_javascript name=\"example\" async=\"true\" />\r\n\r\n<!-- generates -->\r\n<script async src=\"/javascripts/123456/example.js\"></script>\r\n```\r\n\r\nSame thing for `defer`. Just replace `async` above with `defer`. \r\n\r\nResources:\r\n\r\nhttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/script\r\nhttp://www.growingwiththeweb.com/2014/02/async-vs-defer-attributes.html\r\n"},"comment":{"url":"https://api.github.com/repos/wvuweb/cleanslate-cms/issues/comments/114614756","html_url":"https://github.com/wvuweb/cleanslate-cms/issues/163#issuecomment-114614756","issue_url":"https://api.github.com/repos/wvuweb/cleanslate-cms/issues/163","id":114614756,"user":{"login":"nreckart","id":14725,"avatar_url":"https://avatars.githubusercontent.com/u/14725?v=3","gravatar_id":"","url":"https://api.github.com/users/nreckart","html_url":"https://github.com/nreckart","followers_url":"https://api.github.com/users/nreckart/followers","following_url":"https://api.github.com/users/nreckart/following{/other_user}","gists_url":"https://api.github.com/users/nreckart/gists{/gist_id}","starred_url":"https://api.github.com/users/nreckart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nreckart/subscriptions","organizations_url":"https://api.github.com/users/nreckart/orgs","repos_url":"https://api.github.com/users/nreckart/repos","events_url":"https://api.github.com/users/nreckart/events{/privacy}","received_events_url":"https://api.github.com/users/nreckart/received_events","type":"User","site_admin":false},"created_at":"2015-06-23T19:16:45Z","updated_at":"2015-06-23T19:16:45Z","body":"`<r:include_javascript name=\"example\" async=\"true\" />`\r\nand\r\n`<r:include_javascript name=\"example\" defer=\"true\" />`\r\n\r\nAre now supported. Both attributes are optional. You could even use them both together, but the world may explode.\r\n\r\nThe actual content generated for the async bit is `async=\"async\"`, because that's how Rails handles it, apparently."}}