{"id":21954180,"url":"https://github.com/cssobj/cssobj-helper-stylize","last_synced_at":"2026-05-05T03:35:26.170Z","repository":{"id":72105758,"uuid":"63371535","full_name":"cssobj/cssobj-helper-stylize","owner":"cssobj","description":"Apply css text into browser's style tag, can work with plugin-gencss.","archived":false,"fork":false,"pushed_at":"2016-12-14T10:17:21.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T11:19:43.572Z","etag":null,"topics":[],"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/cssobj.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":"2016-07-14T21:38:14.000Z","updated_at":"2016-12-14T09:57:13.000Z","dependencies_parsed_at":"2023-02-24T17:30:15.591Z","dependency_job_id":null,"html_url":"https://github.com/cssobj/cssobj-helper-stylize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssobj%2Fcssobj-helper-stylize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssobj%2Fcssobj-helper-stylize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssobj%2Fcssobj-helper-stylize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssobj%2Fcssobj-helper-stylize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssobj","download_url":"https://codeload.github.com/cssobj/cssobj-helper-stylize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245001917,"owners_count":20545336,"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":[],"created_at":"2024-11-29T07:16:56.210Z","updated_at":"2026-05-05T03:35:21.139Z","avatar_url":"https://github.com/cssobj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cssobj-helper-stylize\n\n[![Join the chat at https://gitter.im/css-in-js/cssobj](https://badges.gitter.im/css-in-js/cssobj.svg)](https://gitter.im/css-in-js/cssobj)\n\nApply css text into browser's style tag, can work with [cssobj-plugin-gencss](https://github.com/cssobj/cssobj-plugin-gencss).\n\n## Usage\n\n``` javascript\nvar cssobj_core = require('cssobj-core')\nvar gencss = require('cssobj-plugin-gencss')\nvar stylize = require('cssobj-helper-stylize')\nvar cssobj = cssobj_core({\n    plugins: [gencss()],\n    onUpdate: stylize({id: 'mycss'})\n  })\ncssobj(obj)\n\n// generated css text will be insert into \u003chead\u003e\n```\n\n## Install\n\n``` javascript\nnpm install cssobj/cssobj-helper-stylize\n```\n\n## API\n\n### `stylize(option?: object) -\u003e (result){}`\n\nReturn a function accept `result` and insert `result.css` into `\u003cstyle\u003e` tag.\n\n### `option`\n\n - `id` : {string} The id for `\u003cstyle\u003e` tag, if omit, will using random string.\n\n - `attrs` : {object} The key/val to apply to `\u003cstyle\u003e` tag as attributes.\n\n### *RETURN*\n\nA function can be used in cssobj `onUpdate` option.\n\n\n## Example\n\n``` javascript\n// in cssobj({ onUpdate:.... })\n\nonUpdate: stylize({name:'index-page-style'})\n\nonUpdate: stylize({name:'index-page-style', attrs:{type:'text/css', media:'screen'} })\n```\n\n## Difference between helper-cssom\n\nThis helper take simplicy first, just update all css text into `\u003cstyle\u003e` tag, may have performance issues.\n\n[plugin-cssom](https://github.com/cssobj/cssobj-plugin-cssom) take effiency first, it create every css rule and patch rules with `result.diff`\n\nIf you want apply cssobj once, and don't update result frequently, use `plugin-gencss` + `helper-stylize`\n\nIf you want update result frequently, use `plugin-cssom`, it optimized for this type of usage.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssobj%2Fcssobj-helper-stylize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssobj%2Fcssobj-helper-stylize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssobj%2Fcssobj-helper-stylize/lists"}