{"action":"created","issue":{"url":"https://api.github.com/repos/styled-components/styled-components/issues/893","repository_url":"https://api.github.com/repos/styled-components/styled-components","labels_url":"https://api.github.com/repos/styled-components/styled-components/issues/893/labels{/name}","comments_url":"https://api.github.com/repos/styled-components/styled-components/issues/893/comments","events_url":"https://api.github.com/repos/styled-components/styled-components/issues/893/events","html_url":"https://github.com/styled-components/styled-components/issues/893","id":234621761,"number":893,"title":"[V2] Using SSR API on client side","user":{"login":"PlanetIrata","id":1729529,"avatar_url":"https://avatars2.githubusercontent.com/u/1729529?v=4","gravatar_id":"","url":"https://api.github.com/users/PlanetIrata","html_url":"https://github.com/PlanetIrata","followers_url":"https://api.github.com/users/PlanetIrata/followers","following_url":"https://api.github.com/users/PlanetIrata/following{/other_user}","gists_url":"https://api.github.com/users/PlanetIrata/gists{/gist_id}","starred_url":"https://api.github.com/users/PlanetIrata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlanetIrata/subscriptions","organizations_url":"https://api.github.com/users/PlanetIrata/orgs","repos_url":"https://api.github.com/users/PlanetIrata/repos","events_url":"https://api.github.com/users/PlanetIrata/events{/privacy}","received_events_url":"https://api.github.com/users/PlanetIrata/received_events","type":"User","site_admin":false},"labels":[{"id":425493754,"url":"https://api.github.com/repos/styled-components/styled-components/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2017-06-08T18:49:26Z","updated_at":"2017-11-01T16:36:35Z","closed_at":null,"author_association":"NONE","body":"I still can't find a way to extract styles _from client side_ with SC2. With SC1, I did it this way:\r\n\r\n```\r\n[render static component...]\r\nlet cssRules = StyleSheet.rules().map(rule => rule.cssText).join('\\n');\r\n```\r\nWhen upgrading to SC2, I switch to the new SSR API:\r\n```\r\nlet sheet = new ServerStyleSheet();\r\n[render static component...]\r\nlet cssRules = sheet.getStyleTags();\r\n```\r\nBut since I'm on client side, I get the \"BrowserTag cannot be cloned!\" error when trying to create the ServerStyleSheet object (see #811).\r\n\r\nDigging the source code, I find this way to do it:\r\n\r\n```\r\n[render static component...]\r\nlet cssRules = StyleSheet.instance.toHTML();\r\n```\r\nBut it generates several `<styles>` tags, some with `data-styled-components` attributes, some comments...not a very clean stylesheet.\r\n\r\nWhat is the proper way to extract SC `<styles>` from the client side, with or without SSR API ?"},"comment":{"url":"https://api.github.com/repos/styled-components/styled-components/issues/comments/341161963","html_url":"https://github.com/styled-components/styled-components/issues/893#issuecomment-341161963","issue_url":"https://api.github.com/repos/styled-components/styled-components/issues/893","id":341161963,"user":{"login":"mCzolko","id":1011500,"avatar_url":"https://avatars1.githubusercontent.com/u/1011500?v=4","gravatar_id":"","url":"https://api.github.com/users/mCzolko","html_url":"https://github.com/mCzolko","followers_url":"https://api.github.com/users/mCzolko/followers","following_url":"https://api.github.com/users/mCzolko/following{/other_user}","gists_url":"https://api.github.com/users/mCzolko/gists{/gist_id}","starred_url":"https://api.github.com/users/mCzolko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mCzolko/subscriptions","organizations_url":"https://api.github.com/users/mCzolko/orgs","repos_url":"https://api.github.com/users/mCzolko/repos","events_url":"https://api.github.com/users/mCzolko/events{/privacy}","received_events_url":"https://api.github.com/users/mCzolko/received_events","type":"User","site_admin":false},"created_at":"2017-11-01T16:36:35Z","updated_at":"2017-11-01T16:36:35Z","author_association":"NONE","body":"@PlanetIrata please could you show us an example of `StyleSheet.instance.toHTML();` and how you use it. Me and @bhovhannes are not able to see the rendered CSS. Thank you"}}
{"actor":{"display_login":"mCzolko"}}