{"action":"created","comment":{"url":"https://api.github.com/repos/FormidableLabs/radium/pulls/comments/36074833","id":36074833,"diff_hunk":"@@ -0,0 +1,70 @@\n+/* @flow */\n+\n+var allPrintStyles = {};\n+var listeners = [];\n+\n+var addListener = function (listener: Function): void {","path":"modules/print-styles.js","position":6,"original_position":6,"commit_id":"6e31490643fc592688435a4107b1c24773374374","original_commit_id":"08e6358fd6866f6350ff7fef3370a64d0528852c","user":{"login":"ianobermiller","id":897931,"avatar_url":"https://avatars.githubusercontent.com/u/897931?v=3","gravatar_id":"","url":"https://api.github.com/users/ianobermiller","html_url":"https://github.com/ianobermiller","followers_url":"https://api.github.com/users/ianobermiller/followers","following_url":"https://api.github.com/users/ianobermiller/following{/other_user}","gists_url":"https://api.github.com/users/ianobermiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ianobermiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianobermiller/subscriptions","organizations_url":"https://api.github.com/users/ianobermiller/orgs","repos_url":"https://api.github.com/users/ianobermiller/repos","events_url":"https://api.github.com/users/ianobermiller/events{/privacy}","received_events_url":"https://api.github.com/users/ianobermiller/received_events","type":"User","site_admin":false},"body":"Fair enough. Though I still think the subscribe method returning an object with remove is a better API than addListener/removeListener","created_at":"2015-08-03T11:00:03Z","updated_at":"2015-08-03T11:00:03Z","html_url":"https://github.com/FormidableLabs/radium/pull/299#discussion_r36074833","pull_request_url":"https://api.github.com/repos/FormidableLabs/radium/pulls/299","_links":{"self":{"href":"https://api.github.com/repos/FormidableLabs/radium/pulls/comments/36074833"},"html":{"href":"https://github.com/FormidableLabs/radium/pull/299#discussion_r36074833"},"pull_request":{"href":"https://api.github.com/repos/FormidableLabs/radium/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/FormidableLabs/radium/pulls/299","id":41262514,"html_url":"https://github.com/FormidableLabs/radium/pull/299","diff_url":"https://github.com/FormidableLabs/radium/pull/299.diff","patch_url":"https://github.com/FormidableLabs/radium/pull/299.patch","issue_url":"https://api.github.com/repos/FormidableLabs/radium/issues/299","number":299,"state":"open","locked":false,"title":"Bringing print styles into the Radium ecosystem","user":{"login":"bobbyrenwick","id":1313013,"avatar_url":"https://avatars.githubusercontent.com/u/1313013?v=3","gravatar_id":"","url":"https://api.github.com/users/bobbyrenwick","html_url":"https://github.com/bobbyrenwick","followers_url":"https://api.github.com/users/bobbyrenwick/followers","following_url":"https://api.github.com/users/bobbyrenwick/following{/other_user}","gists_url":"https://api.github.com/users/bobbyrenwick/gists{/gist_id}","starred_url":"https://api.github.com/users/bobbyrenwick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobbyrenwick/subscriptions","organizations_url":"https://api.github.com/users/bobbyrenwick/orgs","repos_url":"https://api.github.com/users/bobbyrenwick/repos","events_url":"https://api.github.com/users/bobbyrenwick/events{/privacy}","received_events_url":"https://api.github.com/users/bobbyrenwick/received_events","type":"User","site_admin":false},"body":"This is an attempt to handle print styles within the Radium ecosystem. This might not align with your vision so before I add tests and learn how to do flow annotations I thought I'd check what you guys think of this.\r\n\r\nBasically this arises from the issues described in #132. The end result of that issue is that in order to do print styles properly, you need CSS styles with a media query in. Given that I initially went with creating a `<PrintStyle>` component described in a short [blog post](https://medium.com/@bobbyrenwick/print-styles-with-radium-dc26717df387).\r\n\r\nBut I just started doing some more serious work on print styles in our application and this pulled up another issue not listed in that blog post in that when you have an item that is repeated, the styles are repeated for each item. This seemed really wrong so I thought of another solution that works similarly to Relay, in that it looks at all the components that are currently rendered and outputs a `<style>` tag with all the print CSS needed for that.\r\n\r\nI have no idea how to do that on every React render so I've gone for something similar but without being related to what's currently rendered. Anything that gets enhanced with Radium, and has `printStyles` as a static property, will get given a className on render and you can use a `<PrintStyle>` component that contains all the print styles in a media query once in your app.\r\n\r\nWhat do you guys think @ianobermiller @alexlande? Is this something that you want `radium` to do, or is it too much magic?\r\n\r\nP.S Working more on the print styles also revealed that in order to override the inline styles, `!important` should be used on each of the styles. At the moment this'll break when using unitless values but that could be fixed if you guys like this approach","created_at":"2015-07-30T17:54:58Z","updated_at":"2015-08-03T11:00:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed3b30cf66d372a9d80ab6d9a0ea4e17f5551f31","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FormidableLabs/radium/pulls/299/commits","review_comments_url":"https://api.github.com/repos/FormidableLabs/radium/pulls/299/comments","review_comment_url":"https://api.github.com/repos/FormidableLabs/radium/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FormidableLabs/radium/issues/299/comments","statuses_url":"https://api.github.com/repos/FormidableLabs/radium/statuses/6e31490643fc592688435a4107b1c24773374374","head":{"label":"bobbyrenwick:print-styles","ref":"print-styles","sha":"6e31490643fc592688435a4107b1c24773374374","user":{"login":"bobbyrenwick","id":1313013,"avatar_url":"https://avatars.githubusercontent.com/u/1313013?v=3","gravatar_id":"","url":"https://api.github.com/users/bobbyrenwick","html_url":"https://github.com/bobbyrenwick","followers_url":"https://api.github.com/users/bobbyrenwick/followers","following_url":"https://api.github.com/users/bobbyrenwick/following{/other_user}","gists_url":"https://api.github.com/users/bobbyrenwick/gists{/gist_id}","starred_url":"https://api.github.com/users/bobbyrenwick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobbyrenwick/subscriptions","organizations_url":"https://api.github.com/users/bobbyrenwick/orgs","repos_url":"https://api.github.com/users/bobbyrenwick/repos","events_url":"https://api.github.com/users/bobbyrenwick/events{/privacy}","received_events_url":"https://api.github.com/users/bobbyrenwick/received_events","type":"User","site_admin":false},"repo":{"id":38367590,"name":"radium","full_name":"bobbyrenwick/radium","owner":{"login":"bobbyrenwick","id":1313013,"avatar_url":"https://avatars.githubusercontent.com/u/1313013?v=3","gravatar_id":"","url":"https://api.github.com/users/bobbyrenwick","html_url":"https://github.com/bobbyrenwick","followers_url":"https://api.github.com/users/bobbyrenwick/followers","following_url":"https://api.github.com/users/bobbyrenwick/following{/other_user}","gists_url":"https://api.github.com/users/bobbyrenwick/gists{/gist_id}","starred_url":"https://api.github.com/users/bobbyrenwick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobbyrenwick/subscriptions","organizations_url":"https://api.github.com/users/bobbyrenwick/orgs","repos_url":"https://api.github.com/users/bobbyrenwick/repos","events_url":"https://api.github.com/users/bobbyrenwick/events{/privacy}","received_events_url":"https://api.github.com/users/bobbyrenwick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bobbyrenwick/radium","description":"A toolchain for React component styling.","fork":true,"url":"https://api.github.com/repos/bobbyrenwick/radium","forks_url":"https://api.github.com/repos/bobbyrenwick/radium/forks","keys_url":"https://api.github.com/repos/bobbyrenwick/radium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bobbyrenwick/radium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bobbyrenwick/radium/teams","hooks_url":"https://api.github.com/repos/bobbyrenwick/radium/hooks","issue_events_url":"https://api.github.com/repos/bobbyrenwick/radium/issues/events{/number}","events_url":"https://api.github.com/repos/bobbyrenwick/radium/events","assignees_url":"https://api.github.com/repos/bobbyrenwick/radium/assignees{/user}","branches_url":"https://api.github.com/repos/bobbyrenwick/radium/branches{/branch}","tags_url":"https://api.github.com/repos/bobbyrenwick/radium/tags","blobs_url":"https://api.github.com/repos/bobbyrenwick/radium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bobbyrenwick/radium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bobbyrenwick/radium/git/refs{/sha}","trees_url":"https://api.github.com/repos/bobbyrenwick/radium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bobbyrenwick/radium/statuses/{sha}","languages_url":"https://api.github.com/repos/bobbyrenwick/radium/languages","stargazers_url":"https://api.github.com/repos/bobbyrenwick/radium/stargazers","contributors_url":"https://api.github.com/repos/bobbyrenwick/radium/contributors","subscribers_url":"https://api.github.com/repos/bobbyrenwick/radium/subscribers","subscription_url":"https://api.github.com/repos/bobbyrenwick/radium/subscription","commits_url":"https://api.github.com/repos/bobbyrenwick/radium/commits{/sha}","git_commits_url":"https://api.github.com/repos/bobbyrenwick/radium/git/commits{/sha}","comments_url":"https://api.github.com/repos/bobbyrenwick/radium/comments{/number}","issue_comment_url":"https://api.github.com/repos/bobbyrenwick/radium/issues/comments{/number}","contents_url":"https://api.github.com/repos/bobbyrenwick/radium/contents/{+path}","compare_url":"https://api.github.com/repos/bobbyrenwick/radium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bobbyrenwick/radium/merges","archive_url":"https://api.github.com/repos/bobbyrenwick/radium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bobbyrenwick/radium/downloads","issues_url":"https://api.github.com/repos/bobbyrenwick/radium/issues{/number}","pulls_url":"https://api.github.com/repos/bobbyrenwick/radium/pulls{/number}","milestones_url":"https://api.github.com/repos/bobbyrenwick/radium/milestones{/number}","notifications_url":"https://api.github.com/repos/bobbyrenwick/radium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bobbyrenwick/radium/labels{/name}","releases_url":"https://api.github.com/repos/bobbyrenwick/radium/releases{/id}","created_at":"2015-07-01T11:31:48Z","updated_at":"2015-07-01T11:31:48Z","pushed_at":"2015-08-02T22:07:03Z","git_url":"git://github.com/bobbyrenwick/radium.git","ssh_url":"git@github.com:bobbyrenwick/radium.git","clone_url":"https://github.com/bobbyrenwick/radium.git","svn_url":"https://github.com/bobbyrenwick/radium","homepage":"http://projects.formidablelabs.com/radium/","size":1129,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FormidableLabs:master","ref":"master","sha":"6f47912b96fa681b1aea5c963356402f31306c6f","user":{"login":"FormidableLabs","id":5078602,"avatar_url":"https://avatars.githubusercontent.com/u/5078602?v=3","gravatar_id":"","url":"https://api.github.com/users/FormidableLabs","html_url":"https://github.com/FormidableLabs","followers_url":"https://api.github.com/users/FormidableLabs/followers","following_url":"https://api.github.com/users/FormidableLabs/following{/other_user}","gists_url":"https://api.github.com/users/FormidableLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FormidableLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FormidableLabs/subscriptions","organizations_url":"https://api.github.com/users/FormidableLabs/orgs","repos_url":"https://api.github.com/users/FormidableLabs/repos","events_url":"https://api.github.com/users/FormidableLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FormidableLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":29031987,"name":"radium","full_name":"FormidableLabs/radium","owner":{"login":"FormidableLabs","id":5078602,"avatar_url":"https://avatars.githubusercontent.com/u/5078602?v=3","gravatar_id":"","url":"https://api.github.com/users/FormidableLabs","html_url":"https://github.com/FormidableLabs","followers_url":"https://api.github.com/users/FormidableLabs/followers","following_url":"https://api.github.com/users/FormidableLabs/following{/other_user}","gists_url":"https://api.github.com/users/FormidableLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FormidableLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FormidableLabs/subscriptions","organizations_url":"https://api.github.com/users/FormidableLabs/orgs","repos_url":"https://api.github.com/users/FormidableLabs/repos","events_url":"https://api.github.com/users/FormidableLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FormidableLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FormidableLabs/radium","description":"A toolchain for React component styling.","fork":false,"url":"https://api.github.com/repos/FormidableLabs/radium","forks_url":"https://api.github.com/repos/FormidableLabs/radium/forks","keys_url":"https://api.github.com/repos/FormidableLabs/radium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FormidableLabs/radium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FormidableLabs/radium/teams","hooks_url":"https://api.github.com/repos/FormidableLabs/radium/hooks","issue_events_url":"https://api.github.com/repos/FormidableLabs/radium/issues/events{/number}","events_url":"https://api.github.com/repos/FormidableLabs/radium/events","assignees_url":"https://api.github.com/repos/FormidableLabs/radium/assignees{/user}","branches_url":"https://api.github.com/repos/FormidableLabs/radium/branches{/branch}","tags_url":"https://api.github.com/repos/FormidableLabs/radium/tags","blobs_url":"https://api.github.com/repos/FormidableLabs/radium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FormidableLabs/radium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FormidableLabs/radium/git/refs{/sha}","trees_url":"https://api.github.com/repos/FormidableLabs/radium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FormidableLabs/radium/statuses/{sha}","languages_url":"https://api.github.com/repos/FormidableLabs/radium/languages","stargazers_url":"https://api.github.com/repos/FormidableLabs/radium/stargazers","contributors_url":"https://api.github.com/repos/FormidableLabs/radium/contributors","subscribers_url":"https://api.github.com/repos/FormidableLabs/radium/subscribers","subscription_url":"https://api.github.com/repos/FormidableLabs/radium/subscription","commits_url":"https://api.github.com/repos/FormidableLabs/radium/commits{/sha}","git_commits_url":"https://api.github.com/repos/FormidableLabs/radium/git/commits{/sha}","comments_url":"https://api.github.com/repos/FormidableLabs/radium/comments{/number}","issue_comment_url":"https://api.github.com/repos/FormidableLabs/radium/issues/comments{/number}","contents_url":"https://api.github.com/repos/FormidableLabs/radium/contents/{+path}","compare_url":"https://api.github.com/repos/FormidableLabs/radium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FormidableLabs/radium/merges","archive_url":"https://api.github.com/repos/FormidableLabs/radium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FormidableLabs/radium/downloads","issues_url":"https://api.github.com/repos/FormidableLabs/radium/issues{/number}","pulls_url":"https://api.github.com/repos/FormidableLabs/radium/pulls{/number}","milestones_url":"https://api.github.com/repos/FormidableLabs/radium/milestones{/number}","notifications_url":"https://api.github.com/repos/FormidableLabs/radium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FormidableLabs/radium/labels{/name}","releases_url":"https://api.github.com/repos/FormidableLabs/radium/releases{/id}","created_at":"2015-01-09T19:35:59Z","updated_at":"2015-08-03T09:21:54Z","pushed_at":"2015-08-02T22:07:03Z","git_url":"git://github.com/FormidableLabs/radium.git","ssh_url":"git@github.com:FormidableLabs/radium.git","clone_url":"https://github.com/FormidableLabs/radium.git","svn_url":"https://github.com/FormidableLabs/radium","homepage":"http://projects.formidablelabs.com/radium/","size":2670,"stargazers_count":1539,"watchers_count":1539,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":62,"mirror_url":null,"open_issues_count":19,"forks":62,"open_issues":19,"watchers":1539,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FormidableLabs/radium/pulls/299"},"html":{"href":"https://github.com/FormidableLabs/radium/pull/299"},"issue":{"href":"https://api.github.com/repos/FormidableLabs/radium/issues/299"},"comments":{"href":"https://api.github.com/repos/FormidableLabs/radium/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/FormidableLabs/radium/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/FormidableLabs/radium/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FormidableLabs/radium/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/FormidableLabs/radium/statuses/6e31490643fc592688435a4107b1c24773374374"}}}}