{"id":17242858,"url":"https://github.com/imcuttle/react-document-style","last_synced_at":"2026-05-18T10:38:42.795Z","repository":{"id":29733954,"uuid":"122580547","full_name":"imcuttle/react-document-style","owner":"imcuttle","description":"Document style component on client or server side","archived":false,"fork":false,"pushed_at":"2022-01-07T14:01:41.000Z","size":67,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T01:21:11.521Z","etag":null,"topics":["react","react-document-title","server-sider"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imcuttle.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-23T06:09:19.000Z","updated_at":"2018-02-23T06:22:46.000Z","dependencies_parsed_at":"2022-08-07T14:30:42.305Z","dependency_job_id":null,"html_url":"https://github.com/imcuttle/react-document-style","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/imcuttle/react-document-style","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-document-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-document-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-document-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-document-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imcuttle","download_url":"https://codeload.github.com/imcuttle/react-document-style/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-document-style/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33175198,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-document-title","server-sider"],"created_at":"2024-10-15T06:14:16.107Z","updated_at":"2026-05-18T10:38:37.778Z","avatar_url":"https://github.com/imcuttle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-document-style  \n\nWe could render style component either client or server side via [`react-side-effect`](https://github.com/gaearon/react-side-effect).\n\n[![build status](https://img.shields.io/travis/imcuttle/react-document-style/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/react-document-style)\n[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/react-document-style.svg?style=flat-square)](https://codecov.io/github/imcuttle/react-document-style?branch=master)\n[![NPM version](https://img.shields.io/npm/v/react-document-style.svg?style=flat-square)](https://www.npmjs.com/package/react-document-style)\n[![NPM Downloads](https://img.shields.io/npm/dm/react-document-style.svg?style=flat-square\u0026maxAge=43200)](https://www.npmjs.com/package/react-document-style)\n\n- UMD  \nname: `ReactDocumentStyle`  \nrequires `React` and `PropTypes`\n- https://unpkg.com/react-document-style  \n- https://cdn.jsdelivr.net/npm/react-document-style\n\n## Usage\nThe Component writing like here.\n```javascript\nimport Style from 'react-document-style'\nconst css = 'body { color: red; }'\n\nexport default () =\u003e (\n  \u003cStyle css={css}\u003e\n    \u003cdiv\u003e\n      Hi\n      \u003cStyle css={'div { color: blue; }'}/\u003e\n    \u003c/div\u003e\n  \u003c/Style\u003e\n)\n```\n\n- Client  \nWould create a style DOM in `head`\n```html\n\u003chead\u003e\n\u003cstyle type=\"text/css\"\u003e\nbody { color: red; }\ndiv { color: blue; }\n\u003c/style\u003e\n\u003c/head\u003e\n```\n\n- Server  \nCall `rewind` or `peek` to get the css string on server side **after render component**.  \nplease see the doc about [react-side-effect](https://github.com/gaearon/react-side-effect/) for more information\n```js\nReactServerDOM.renderToString(\u003cStyle css={'div { color: blue; }'}/\u003e)\nStyle.peek() // div { color: blue; }\nStyle.rewind() // div { color: blue; }\nStyle.peek() // undefined\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Freact-document-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimcuttle%2Freact-document-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Freact-document-style/lists"}