{"id":16899810,"url":"https://github.com/bloodyowl/react-styled","last_synced_at":"2025-06-10T15:07:00.470Z","repository":{"id":29195824,"uuid":"32727032","full_name":"bloodyowl/react-styled","owner":"bloodyowl","description":"styled component for react \u0026 style-loader/usable","archived":false,"fork":false,"pushed_at":"2016-05-30T11:56:31.000Z","size":187,"stargazers_count":39,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-31T04:09:18.918Z","etag":null,"topics":[],"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/bloodyowl.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":"2015-03-23T11:04:18.000Z","updated_at":"2023-07-23T05:45:52.000Z","dependencies_parsed_at":"2022-08-17T19:40:57.184Z","dependency_job_id":null,"html_url":"https://github.com/bloodyowl/react-styled","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloodyowl%2Freact-styled","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloodyowl%2Freact-styled/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloodyowl%2Freact-styled/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloodyowl%2Freact-styled/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bloodyowl","download_url":"https://codeload.github.com/bloodyowl/react-styled/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloodyowl%2Freact-styled/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259098454,"owners_count":22804783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-13T17:50:25.052Z","updated_at":"2025-06-10T15:07:00.379Z","avatar_url":"https://github.com/bloodyowl.png","language":"JavaScript","funding_links":[],"categories":["CSS in JS"],"sub_categories":["Editor's Draft :black_nib:"],"readme":"# react-styled\n\n\u003e ES7 decorator for dynamic stylesheet usage w/ webpack\n\n[![Build Status](https://travis-ci.org/bloodyowl/react-styled.svg?branch=master)](https://travis-ci.org/bloodyowl/react-styled)\n\n## install\n\n```console\n$ npm install bloody-react-styled --save-dev\n```\n\n## require\n\n```javascript\nimport styled from \"bloody-react-styled\"\n```\n\n## API\n\n### @styled(styles) class\n\nstyled is a ES7 decorator that applies useable style only if at least one\ninstance of the component it is attached to is in mounted,\nand removes it when there are no more instances.\n\n## how to\n\nfirst, install `style-loader`, `css-loader` and possibility the loader\nof your choice for a pre/post-processor.\n\n```console\n$ npm install --save-dev style-loader css-loader\n```\n\nto configure webpack for that, use in your webpack.config.js :\n\n```javascript\nconst config = {\n  // ...\n  module : {\n    loaders : [\n      // ...\n      {\n        test : /\\.css$/,\n        loaders: [\n          // use the useable to only use the stylesheet when necessary\n          \"style/useable\",\n          \"css\",\n          // example of css processor you might want to use\n          \"cssnext\",\n        ],\n      },\n    ],\n  },\n  // ...\n}\n```\n\nthen you can do\n\n```javascript\nimport React, {Component} from \"react\"\nimport styled from \"bloody-react-styled\"\n\nimport styles from \"./styles.css\"\n\n@styled(styles)\nclass MyComponent extends Component {\n\n  render() {\n    return (\n      \u003cdiv className=\"MyComponent\"\u003e\n        will be styled!\n      \u003c/div\u003e\n    )\n  }\n}\n\nexport default MyComponent\n```\n\n## local stylesheets with css-loader\n\n### css\n\n```css\n:local .default {\n  padding: 1rem;\n}\n```\n\n### js\n\n```javascript\nimport React, {Component} from \"react\"\nimport styled from \"bloody-react-styled\"\n\nimport styles from \"./styles.css\"\n\n@styled(styles)\nclass MyComponent extends Component {\n\n  render() {\n    const {locals} = styles\n    return (\n      \u003cdiv className={locals.default}\u003e\n        will be styled!\n      \u003c/div\u003e\n    )\n  }\n}\n\nexport default MyComponent\n```\n\n## [license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbloodyowl%2Freact-styled","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbloodyowl%2Freact-styled","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbloodyowl%2Freact-styled/lists"}