{"id":19653035,"url":"https://github.com/csstools/custom-units","last_synced_at":"2025-04-28T17:31:13.438Z","repository":{"id":51566611,"uuid":"520488763","full_name":"csstools/custom-units","owner":"csstools","description":"Use Custom Units in CSS","archived":false,"fork":false,"pushed_at":"2024-12-27T18:04:17.000Z","size":7,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-19T11:04:21.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/csstools.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,"zenodo":null}},"created_at":"2022-08-02T12:26:53.000Z","updated_at":"2025-03-07T06:10:26.000Z","dependencies_parsed_at":"2025-04-19T03:41:36.430Z","dependency_job_id":"6207f6ef-3703-4f57-98f4-3662017d1baf","html_url":"https://github.com/csstools/custom-units","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"6fbf9684da3bf4bfbe4158970b4ac2b834190f85"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fcustom-units","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fcustom-units/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fcustom-units/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fcustom-units/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csstools","download_url":"https://codeload.github.com/csstools/custom-units/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251216916,"owners_count":21554087,"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-11T15:12:58.704Z","updated_at":"2025-04-28T17:31:13.400Z","avatar_url":"https://github.com/csstools.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.npmjs.com/package/@csstools/custom-units\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@csstools/custom-units?color=%23444\u0026label=\u0026labelColor=%23CB0000\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjE1MCAxNTAgNDAwIDQwMCIgZmlsbD0iI0ZGRiI+PHBhdGggZD0iTTE1MCA1NTBoMjAwVjI1MGgxMDB2MzAwaDEwMFYxNTBIMTUweiIvPjwvc3ZnPg==\u0026style=for-the-badge\" alt=\"PostCSS Custom Units\" align=\"right\" valign=\"middle\" height=\"32\" /\u003e\u003c/a\u003e\n\n# PostCSS Custom Units\n\n**PostCSS Custom Units** lets you use custom units in CSS, following the [CSSWG Proposal](https://github.com/w3c/csswg-drafts/issues/7379).\n\n```pcss\n:root {\n  /** Step (approximately 4px when 1rem is 16px) */\n  --step: .25rem;\n\n  /** Relative Pixel (approximately 1px when 1rem is 16px) */\n  --rpx: .0625rem;\n}\n\n.my-component {\n  font-size: 24--rpx;\n  padding-inline: 3--step;\n}\n\n/* becomes */\n\n:root {\n  /** Step (approximately 4px when 1rem is 16px) */\n  --step: .25rem;\n\n  /** Relative Pixel (approximately 1px when 1rem is 16px) */\n  --rpx: .0625rem;\n}\n\n.my-component {\n  font-size: max(24 * var(--rpx));\n  padding-inline: max(3 * var(--step));\n}\n```\n\n## Usage\n\nAdd **PostCSS Custom Units** to your project:\n\n```shell\nnpm install @csstools/custom-units --save-dev\n```\n\nUse **PostCSS Custom Units** to process your CSS:\n\n```js\nconst postcssCustomUnits = require('@csstools/custom-units');\n\npostcssCustomUnits.process(YOUR_CSS /*, processOptions, pluginOptions */);\n```\n\nOr use it as a **PostCSS** plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssCustomUnits = require('@csstools/custom-units');\n\npostcss([\n  postcssCustomUnits(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fcustom-units","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsstools%2Fcustom-units","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fcustom-units/lists"}