{"id":22197873,"url":"https://github.com/onmax/css4ify","last_synced_at":"2025-03-24T23:34:44.422Z","repository":{"id":225797581,"uuid":"766883181","full_name":"onmax/css4ify","owner":"onmax","description":"Converts CSS to JSON","archived":false,"fork":false,"pushed_at":"2025-02-21T11:19:01.000Z","size":177,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T22:21:23.159Z","etag":null,"topics":["css-nesting","css-to-js","csstree"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/onmax.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}},"created_at":"2024-03-04T10:01:45.000Z","updated_at":"2025-01-18T04:34:22.000Z","dependencies_parsed_at":"2024-03-04T11:43:22.764Z","dependency_job_id":null,"html_url":"https://github.com/onmax/css4ify","commit_stats":null,"previous_names":["onmax/cssify"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmax%2Fcss4ify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmax%2Fcss4ify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmax%2Fcss4ify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmax%2Fcss4ify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onmax","download_url":"https://codeload.github.com/onmax/css4ify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372221,"owners_count":20604488,"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":["css-nesting","css-to-js","csstree"],"created_at":"2024-12-02T14:24:28.737Z","updated_at":"2025-03-24T23:34:44.393Z","avatar_url":"https://github.com/onmax.png","language":"TypeScript","readme":"# css4ify\n\nA simple tool to convert CSS to JSON and JSON to CSS.\n\n- 🌲 Uses [`csstree`](https://github.com/csstree/csstree) to parse CSS\n- 🚀 ESM support\n- 🤘 TypeScript support\n- 🔮 CSS 4 features supported like CSS Nesting and modern pseudoselectors\n- 📦 Bundled with [Bun](https://bun.sh)\n- 📎 Lightweight\n\n## Usage\n\n```bash\nnpm install css4ify\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eConvert CSS to JSON\u003c/summary\u003e\n\n```javascript\nimport { jsonify } from 'css4ify';\n\nconst json = jsonify(`\n  .foo {\n    color: red;\n  }\n  .bar {\n    color: blue;\n\n    \u0026:hover {\n      color: green;\n    }\n  }\n`);\n```\n\nIt will return:\n\n```json\n{\n  \".foo\": {\n    \"color\": \"red\"\n  },\n  \".bar\": {\n    \"color\": \"blue\",\n    \"\u0026:hover\": {\n      \"color\": \"green\"\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eConvert JSON to CSS\u003c/summary\u003e\n\n```javascript\nimport { stringify } from 'css4ify';\n\nconst css = stringify({\n  \".foo\": {\n    \"color\": \"red\"\n  },\n  \".bar\": {\n    \"color\": \"blue\",\n    \"\u0026:hover\": {\n      \"color\": \"green\"\n    }\n  }\n});\n```\n\nIt will return:\n\n```css\n.foo {\n  color: red;\n}\n.bar {\n  color: blue;\n  \u0026:hover {\n    color: green;\n  }\n}\n```\n\n\u003c/details\u003e\n\n## Missing features\n\n\u003e This project is in early stages and may not support all CSS features. You can help by opening an issue or a pull request.\n\n\u003e CSS Nesting is NOT supported when there is properties after the nested selector. For example:\n\n```css\n/* This will not work */\n.foo {\n  color: red;\n  \u0026:hover {\n    color: green;\n  }\n  background-color: blue;\n}\n```\n\nTo solve it, just move the properties to be before the nested selector:\n\n```css\n/* This will work */\n.foo {\n  color: red;\n  background-color: blue;\n  \u0026:hover {\n    color: green;\n  }\n}\n```\n\n## Development\n\nTo install dependencies:\n\n```bash\nbun install\n```\n\nTo run:\n\n```bash\nbun run src/index.ts\n```\n\nThis project was created using `bun init` in bun v1.0.20. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonmax%2Fcss4ify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonmax%2Fcss4ify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonmax%2Fcss4ify/lists"}