{"id":13725700,"url":"https://github.com/satya164/babel-plugin-css-prop","last_synced_at":"2025-03-16T19:31:27.941Z","repository":{"id":57188802,"uuid":"150173789","full_name":"satya164/babel-plugin-css-prop","owner":"satya164","description":"Babel plugin to transpile `css` prop to a styled component. (Experimental)","archived":false,"fork":false,"pushed_at":"2018-10-11T12:43:29.000Z","size":151,"stargazers_count":55,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-21T13:40:13.430Z","etag":null,"topics":["babel","babel-plugin","linaria","styled-components"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/satya164.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-24T21:59:52.000Z","updated_at":"2022-11-29T16:17:37.000Z","dependencies_parsed_at":"2022-08-28T12:51:36.961Z","dependency_job_id":null,"html_url":"https://github.com/satya164/babel-plugin-css-prop","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-css-prop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-css-prop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-css-prop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-css-prop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/satya164","download_url":"https://codeload.github.com/satya164/babel-plugin-css-prop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826780,"owners_count":20354220,"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":["babel","babel-plugin","linaria","styled-components"],"created_at":"2024-08-03T01:02:31.825Z","updated_at":"2025-03-16T19:31:27.615Z","avatar_url":"https://github.com/satya164.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# babel-plugin-css-prop\n\nBabel plugin to transpile `css` prop to a styled component.\n\nThe plugin will let you use the `css` prop ala [`emotion`](https://emotion.sh/) in libraries like [`linaria`](https://github.com/callstack/linaria) and [`styled-components`](https://www.styled-components.com/). Internally, it will convert the `css` prop to a styled component.\n\n## Usage\n\nInstall the plugin:\n\n```sh\nyarn add --dev babel-plugin-css-prop\n```\n\nThen include it in your `.babelrc`:\n\n```json\n{\n  \"plugins\": [\"css-prop\"]\n}\n```\n\n## Example\n\nNow you can use the `css` prop in your components:\n\n```js\nfunction App(props) {\n  return (\n    \u003cdiv\n      css={`\n        flex: 1;\n        background-color: ${props.bg};\n      `}\n    \u003e\n      Hello world\n    \u003c/div\u003e\n  );\n}\n```\n\nYou are not restricted to template literals in the `css` prop. You can also use a plain string.\n\nThe only restrictions are:\n\n1. The prop must be specified directly on the JSX element, since the plugin uses it to detect the prop.\n2. The element using the `css` prop must be inside a component/function and not in the top level scope.\n\n## Options\n\n- `target: \"linaria\" | \"styled-components\" | \"auto\" | \"none\"`: The CSS-in-JS library you use. If you specify the library, the plugin will auto-insert a require statement for `styled` when needed. If you set it to `\"auto\"`, it will try to auto-detect which library you use by reading your `package.json`. If you set it to `\"none\"`, require statements won't be inserted. (Default: `\"auto\"`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatya164%2Fbabel-plugin-css-prop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsatya164%2Fbabel-plugin-css-prop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatya164%2Fbabel-plugin-css-prop/lists"}