{"id":16528956,"url":"https://github.com/satya164/babel-plugin-object-styles-to-template","last_synced_at":"2025-03-21T09:31:42.186Z","repository":{"id":66198878,"uuid":"112242334","full_name":"satya164/babel-plugin-object-styles-to-template","owner":"satya164","description":"Babel plugin to transpile object styles to template literal","archived":false,"fork":false,"pushed_at":"2018-10-11T12:45:31.000Z","size":170,"stargazers_count":36,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T02:36:51.047Z","etag":null,"topics":["babel","babel-plugin","linaria","styled-components"],"latest_commit_sha":null,"homepage":"","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-27T20:01:27.000Z","updated_at":"2025-01-24T07:40:16.000Z","dependencies_parsed_at":"2023-02-25T22:30:19.750Z","dependency_job_id":null,"html_url":"https://github.com/satya164/babel-plugin-object-styles-to-template","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"5ed9f976826af3964e66156a20489104cfed36f6"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-object-styles-to-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-object-styles-to-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-object-styles-to-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satya164%2Fbabel-plugin-object-styles-to-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/satya164","download_url":"https://codeload.github.com/satya164/babel-plugin-object-styles-to-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130278,"owners_count":20402753,"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-10-11T17:42:28.298Z","updated_at":"2025-03-21T09:31:41.881Z","avatar_url":"https://github.com/satya164.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-object-styles-to-template\n\nBabel plugin to transpile object styles to template literal.\n\nThe plugin will convert styles written in object syntax to tagged template literal which libraries like [`linaria`](https://github.com/callstack/linaria) and [`styled-components`](https://www.styled-components.com/) can consume.\n\n## Usage\n\nInstall the plugin:\n\n```sh\nyarn add --dev babel-plugin-object-styles-to-template\n```\n\nThen include it in your `.babelrc`:\n\n```json\n{\n  \"plugins\": [\"object-styles-to-template\"]\n}\n```\n\n## Example\n\nWhen you write the following:\n\n```js\nconst container = css({\n  flex: 1,\n  padding: 10,\n  backgroundColor: 'orange',\n  color: colors.white,\n\n  '\u0026:hover': {\n    backgroundColor: 'tomato',\n  },\n});\n```\n\nIt's transpiled to:\n\n```js\nconst container = css`\n  flex: 1;\n  padding: 10px;\n  background-color: orange;\n  color: ${colors.white};\n\n  \u0026:hover {\n    background-color: tomato;\n  }\n`;\n```\n\nThe styled components syntax is also supported. So when you write the following:\n\n```js\nconst FancyButton = styled(Button)({\n  backgroundColor: 'papayawhip',\n});\n```\n\nIt's transpiled to:\n\n```js\nconst FancyButton = styled(Button)`\n  background-color: papayawhip;\n`;\n```\n\n## Options\n\nYou can selectively enable/disable the tags transpiled by the plugin:\n\n- `css: boolean`: Whether to transpile `css` tags. Default: `true`.\n- `styled: boolean`: Whether to transpile styled components like `styled` tags. Default `true`.\n\nTo pass options to the plugin, you can use the following syntax:\n\n```json\n{\n  \"plugins\": [\n    [\"object-styles-to-template\", { \"css\": true, \"styled\": false }]\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatya164%2Fbabel-plugin-object-styles-to-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsatya164%2Fbabel-plugin-object-styles-to-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatya164%2Fbabel-plugin-object-styles-to-template/lists"}