{"id":16125567,"url":"https://github.com/semibran/css-string","last_synced_at":"2025-08-04T19:39:13.164Z","repository":{"id":130492026,"uuid":"97786996","full_name":"semibran/css-string","owner":"semibran","description":":evergreen_tree: create CSS-compatible strings from object trees","archived":false,"fork":false,"pushed_at":"2020-12-07T08:14:22.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T20:20:47.774Z","etag":null,"topics":["css","stringify","tree","virtual-dom"],"latest_commit_sha":null,"homepage":"","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/semibran.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,"governance":null}},"created_at":"2017-07-20T03:33:53.000Z","updated_at":"2020-12-07T08:14:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"80428861-d748-41cc-9506-caf4b4f31532","html_url":"https://github.com/semibran/css-string","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"017c0145d4e49ef3aa36d681159158c606f4c4f7"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fcss-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semibran","download_url":"https://codeload.github.com/semibran/css-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243928161,"owners_count":20370243,"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","stringify","tree","virtual-dom"],"created_at":"2024-10-09T21:30:00.868Z","updated_at":"2025-03-18T13:30:46.543Z","avatar_url":"https://github.com/semibran.png","language":"JavaScript","readme":"# css-string\n\u003e create CSS-compatible strings from object trees\n\n```js\nlet style = document.createElement(\"style\")\ndocument.head.appendChild(style)\nstyle.innerText = stringify({\n  body: {\n    display: \"flex\",\n    height: \"100%\"\n  }\n})\n```\n\nThis package exposes the `stringify` function, which creates CSS-compatible strings from object trees. The resulting strings can be used directly in dynamic stylesheets as well as [`HTMLElement.style`][HTMLElement.style].\n\n## usage\n[![npm badge]][npm package]\n\n```js\n\u003e stringify({ color: \"red\" })\n\"color:red\"\n```\n\nUse strings as keys to represent complex selectors, property names, and values.\n\n```js\n\u003e stringify({\n    \"*\": {\n      \"margin\": 0,\n      \"padding\": 0,\n      \"box-sizing\": \"border-box\"\n    }\n  })\n\"*{margin:0;padding:0;box-sizing:border-box}\"\n```\n\nIf a declaration has an object as its value, it will be treated as a rule with its own selector and declarations.\n\n```js\n\u003e stringify({\n    nav: {\n      display: \"flex\",\n      a: {\n        color: \"inherit\"\n      }\n    }\n  })\n\"nav{display:flex;a{color:inherit}}\"\n```\n\n## license\n[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)\n\n[npm package]:       https://www.npmjs.com/package/css-string\n[npm badge]:         https://nodei.co/npm/css-string.png?mini\n[HTMLElement.style]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fcss-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemibran%2Fcss-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fcss-string/lists"}