{"id":25504343,"url":"https://github.com/farefirst/styled-jsx-plugin-root-theme-provider","last_synced_at":"2025-04-10T10:24:02.632Z","repository":{"id":49535966,"uuid":"146943656","full_name":"FareFirst/styled-jsx-plugin-root-theme-provider","owner":"FareFirst","description":"Plug-in to use :root selector power to build themed Styled-JSX","archived":false,"fork":false,"pushed_at":"2022-12-30T18:27:18.000Z","size":155,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T15:05:35.090Z","etag":null,"topics":["postcss-preset-env","styled-jsx","styled-jsx-plugin","theme-provider"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FareFirst.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-08-31T21:25:54.000Z","updated_at":"2023-07-09T20:23:15.000Z","dependencies_parsed_at":"2023-01-31T13:00:48.571Z","dependency_job_id":null,"html_url":"https://github.com/FareFirst/styled-jsx-plugin-root-theme-provider","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareFirst%2Fstyled-jsx-plugin-root-theme-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareFirst%2Fstyled-jsx-plugin-root-theme-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareFirst%2Fstyled-jsx-plugin-root-theme-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareFirst%2Fstyled-jsx-plugin-root-theme-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FareFirst","download_url":"https://codeload.github.com/FareFirst/styled-jsx-plugin-root-theme-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199087,"owners_count":21063641,"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":["postcss-preset-env","styled-jsx","styled-jsx-plugin","theme-provider"],"created_at":"2025-02-19T05:35:24.975Z","updated_at":"2025-04-10T10:24:02.624Z","avatar_url":"https://github.com/FareFirst.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# styled-jsx-plugin-root-theme-provider\n\n[![Build Status](https://travis-ci.org/FareFirst/styled-jsx-plugin-root-theme-provider.svg?branch=master)](https://travis-ci.org/FareFirst/styled-jsx-plugin-root-theme-provider)\n[![npm](https://img.shields.io/npm/v/styled-jsx-plugin-root-theme-provider.svg)](https://www.npmjs.com/package/styled-jsx-plugin-root-theme-provider)\n\n\nPlugin to use `var` and `:root` css power to build themed [styled-jsx](https://github.com/zeit/styled-jsx) with older browser support. Under the hood it uses **postcss-preset-env**, so it will also enable latest css features.\n\n## Install\n\n```bash\nnpm install --save styled-jsx-plugin-root-theme-provider\n```\n\nNext, add `styled-jsx-plugin-root-theme-provider` to the `styled-jsx`'s `plugins` in your\nbabel configuration:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"styled-jsx/babel\",\n      {\n        \"plugins\": [\n          [\n            \"styled-jsx-plugin-root-theme-provider\",\n            {\n              \"themeFilePath\": \"./theme.css\"\n            }\n          ]\n        ]\n      }\n    ]\n  ]\n}\n```\n\n**For Next.js**\n\n```json\n{\n  \"presets\": [\n    [\n      \"next/babel\",\n      {\n        \"styled-jsx\": {\n          \"plugins\": [\n            [\n              \"styled-jsx-plugin-root-theme-provider\",\n              {\n                \"themeFilePath\": \"./theme.css\"\n              }\n            ]\n          ]\n        }\n      }\n    ]\n  ]\n}\n\n```\n\n## Usage\n\nCreate a css file\n\n./theme.css\n```css\n:root {\n  --red: red,\n  --blue: #000032;\n}\n```\n\nConfigure this file as theme file in .bablerc using `themeFilePath` option\n\n**Make sure ./theme.css is part of your global css**\n\nNow in your styled-jsx use any `var` or latest css feature supported by **postcss-preset-env**.\n\n```html\n\u003cstyle jsx\u003e\n.a {\n  background: var(--red);\n}\n\u003c/style\u003e\n\n```\n\nIn browser this css will be translated to\n\n```css\n.a {\n  background: red;\n  background: var(--red);\n}\n```\n\n#### Notes\n\n[styled-jsx-plugin-root-theme-provider](https://github.com/nawaf331/styled-jsx-plugin-root-theme-provider) uses [styled-jsx](https://github.com/zeit/styled-jsx#css-preprocessing-via-plugins)'s plugin system which is supported from version 2. Read more on their repository for further info.\n\n## Options\n\n**themeFilePath [Optional]** : To configure theme css file path\n\n**postcssPresetEnvOptions [Optional]** : To configure postcss-preset-env\n\n#### Default stage for postcss-preset-env is 0\n\n## Contributing\n\nPR's are welcome!\n\nThanks to all [the contributors](https://github.com/nawaf331/styled-jsx-plugin-root-theme-provider/graphs/contributors)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarefirst%2Fstyled-jsx-plugin-root-theme-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarefirst%2Fstyled-jsx-plugin-root-theme-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarefirst%2Fstyled-jsx-plugin-root-theme-provider/lists"}