{"id":13727173,"url":"https://github.com/kripod/style-vendorizer","last_synced_at":"2025-08-09T03:40:58.256Z","repository":{"id":40000707,"uuid":"295232532","full_name":"kripod/style-vendorizer","owner":"kripod","description":"Tiny CSS vendor prefixer and property alias mapper for runtime styling solutions","archived":false,"fork":false,"pushed_at":"2022-08-25T05:54:05.000Z","size":1575,"stargazers_count":59,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-05T12:47:21.340Z","etag":null,"topics":["alias","css","mapper","prefixer","resolver"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/kripod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"kripod"}},"created_at":"2020-09-13T20:31:37.000Z","updated_at":"2024-08-16T20:18:46.000Z","dependencies_parsed_at":"2022-06-26T10:34:20.223Z","dependency_job_id":null,"html_url":"https://github.com/kripod/style-vendorizer","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/kripod/style-vendorizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fstyle-vendorizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fstyle-vendorizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fstyle-vendorizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fstyle-vendorizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kripod","download_url":"https://codeload.github.com/kripod/style-vendorizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fstyle-vendorizer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269170586,"owners_count":24372066,"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","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["alias","css","mapper","prefixer","resolver"],"created_at":"2024-08-03T01:03:42.790Z","updated_at":"2025-08-09T03:40:58.144Z","avatar_url":"https://github.com/kripod.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kripod"],"categories":["TypeScript"],"sub_categories":[],"readme":"# style-vendorizer\n\nTiny CSS vendor prefixer and property alias mapper for runtime styling solutions.\n\n[![npm](https://img.shields.io/npm/v/style-vendorizer)](https://www.npmjs.com/package/style-vendorizer)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/style-vendorizer)](https://bundlephobia.com/package/style-vendorizer)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/kripod/style-vendorizer/CI/main)](https://github.com/kripod/style-vendorizer/actions/workflows/ci.yaml)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](./CODE_OF_CONDUCT.md)\n\n## Usage\n\nInstall the library with a package manager, e.g. npm:\n\n```shell\nnpm install style-vendorizer\n```\n\nAfter that, import transformer functions on demand. A recommended starting point is shown below:\n\n```js\nimport {\n  cssPropertyAlias,\n  cssPropertyPrefixFlags,\n  cssValuePrefixFlags,\n} from \"style-vendorizer\";\n\nfunction styleDeclaration(property, value) {\n  let cssText = \"\";\n\n  /* Resolve aliases, e.g. `gap` -\u003e `grid-gap` */\n  const propertyAlias = cssPropertyAlias(property);\n  if (propertyAlias) cssText += `${propertyAlias}:${value};`;\n\n  /* Prefix properties, e.g. `backdrop-filter` -\u003e `-webkit-backdrop-filter` */\n  const propertyFlags = cssPropertyPrefixFlags(property);\n  if (propertyFlags \u0026 0b001) cssText += `-webkit-${property}:${value};`;\n  if (propertyFlags \u0026 0b010) cssText += `-moz-${property}:${value};`;\n  if (propertyFlags \u0026 0b100) cssText += `-ms-${property}:${value};`;\n\n  /* Prefix values, e.g. `position: \"sticky\"` -\u003e `position: \"-webkit-sticky\"` */\n  /* Notice that flags don't overlap and property prefixing isn't needed here */\n  const valueFlags = cssValuePrefixFlags(property, value);\n  if (valueFlags \u0026 0b001) cssText += `${property}:-webkit-${value};`;\n  else if (valueFlags \u0026 0b010) cssText += `${property}:-moz-${value};`;\n  else if (valueFlags \u0026 0b100) cssText += `${property}:-ms-${value};`;\n\n  /* Include the standardized declaration last */\n  /* https://css-tricks.com/ordering-css3-properties/ */\n  cssText += `${property}:${value};`;\n\n  return cssText;\n}\n```\n\nPrefix flags may be defined in TypeScript without any overhead as follows:\n\n\u003c!-- prettier-ignore-start --\u003e\n\n```ts\nconst enum CSSPrefixFlags {\n  \"-webkit-\" = 1 \u003c\u003c 0, // 0b001\n     \"-moz-\" = 1 \u003c\u003c 1, // 0b010\n      \"-ms-\" = 1 \u003c\u003c 2, // 0b100\n}\n\n/* Magic numbers from the previous snippet should be replaced like below: */\nif (flags \u0026 CSSPrefixFlags[\"-webkit-\"]) cssText += \"...\";\nif (flags \u0026 CSSPrefixFlags[\"-moz-\"]) cssText += \"...\";\nif (flags \u0026 CSSPrefixFlags[\"-ms-\"]) cssText += \"...\";\n```\n\n\u003c!-- prettier-ignore-end --\u003e\n\n## Browser Support\n\nEvery browser in the default [Browserslist](https://github.com/browserslist/browserslist) configuration is supported and tested against:\n\n- Baidu Browser for Android 7.12+\n- Chrome 57+\n- Edge 16+\n- Firefox 48+\n- Internet Explorer 11\n- KaiOS Browser 2.5+\n- Opera 46+\n- Safari 12.2+\n- Samsung Internet Browser 11.1+\n- QQ Browser for Android 10.4+\n- UC Browser for Android 12.12+\n\n## Quirks\n\n- Function values are only prefixed for longhand properties. This guarantees that only the start of each value is compared, for efficiency:\n\n  ```js\n  // Prints \"1 0\"\n  console.log(\n    cssPropertyPrefixFlags(\n      \"background-image\", // Longhand\n      \"image-set('example.png' 1x, 'example-2x.png' 2x)\", // Prefixed\n    ),\n    cssPropertyPrefixFlags(\n      \"background\", // Shorthand\n      \"image-set('example.png' 1x, 'example-2x.png' 2x)\", // Not prefixed\n    ),\n  );\n  ```\n\n- CSS Grid works in IE 11 only when using the following longhand properties:\n  - `grid-template-rows`, `grid-template-columns`\n  - `grid-row-start`, `grid-column-start`\n  - `-ms-grid-row-span` and `-ms-grid-column-span` (along with `grid-row-end` and `grid-column-end` for cross-browser compatibility)\n  - `align-self`, `justify-self`\n- `cross-fade()` and `element()` functions are not prefixed, due to the lack of standard implementations.\n- Selectors are not yet supported.\n\n## Acknowledgements\n\nThis project was heavily inspired by [tiny-css-prefixer](https://github.com/kitten/tiny-css-prefixer). Test vectors are obtained from [@mdn/browser-compat-data](https://github.com/mdn/browser-compat-data).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkripod%2Fstyle-vendorizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkripod%2Fstyle-vendorizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkripod%2Fstyle-vendorizer/lists"}