{"id":22105231,"url":"https://github.com/zhangyu1818/dynamic-stylesheet","last_synced_at":"2025-03-24T02:44:52.302Z","repository":{"id":57217725,"uuid":"365662369","full_name":"zhangyu1818/dynamic-stylesheet","owner":"zhangyu1818","description":"dynamic inject css with javascript.","archived":false,"fork":false,"pushed_at":"2021-05-09T04:29:52.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-22T22:45:41.219Z","etag":null,"topics":["dynamic-css","inject-css","stylesheet"],"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/zhangyu1818.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":"2021-05-09T03:55:58.000Z","updated_at":"2024-02-18T16:59:19.000Z","dependencies_parsed_at":"2022-08-28T21:40:35.224Z","dependency_job_id":null,"html_url":"https://github.com/zhangyu1818/dynamic-stylesheet","commit_stats":null,"previous_names":["zhangyu1818/inject-css"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangyu1818%2Fdynamic-stylesheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangyu1818%2Fdynamic-stylesheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangyu1818%2Fdynamic-stylesheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangyu1818%2Fdynamic-stylesheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhangyu1818","download_url":"https://codeload.github.com/zhangyu1818/dynamic-stylesheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245200675,"owners_count":20576673,"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":["dynamic-css","inject-css","stylesheet"],"created_at":"2024-12-01T06:39:58.325Z","updated_at":"2025-03-24T02:44:52.279Z","avatar_url":"https://github.com/zhangyu1818.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamic-stylesheet\n\n![npm-version](https://img.shields.io/npm/v/dynamic-stylesheet.svg)\n[![codecov](https://codecov.io/gh/zhangyu1818/dynamic-stylesheet/branch/main/graph/badge.svg?token=0ZTpVwfEDU)](https://codecov.io/gh/zhangyu1818/dynamic-stylesheet)\n![bundlesize-js-image](https://img.badgesize.io/https:/unpkg.com/dynamic-stylesheet/dist/index.js?label=gzip\u0026compression=gzip\u0026style=flat-square)\n\ndynamic inject css with javascript.\n\n## Install\n\n```bash\nnpm install dynamic-stylesheet\n```\n\n```bash\nyarn add dynamic-stylesheet\n```\n\n## Usage\n\n```javascript\nimport { injectCSS, updateCSS } from 'dynamic-stylesheet'\n\nconst styleText = \".container:before{ content:'before content' }\"\n\n// default insert to document.head\ninjectCSS(styleText)\n// attach to element\ninjectCSS(styleText, { attachTo: document.body })\n\n// updateCSS will use the same node with the same key\nupdateCSS(styleText, 'mark-key')\n\nconst updateStyleText = \".container:after{ content:'after content' }\"\n\nupdateCSS(updateStyleText, 'mark-key')\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangyu1818%2Fdynamic-stylesheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhangyu1818%2Fdynamic-stylesheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangyu1818%2Fdynamic-stylesheet/lists"}