{"id":28326872,"url":"https://github.com/lab4studio/postcss-px-to-rem","last_synced_at":"2026-02-27T16:05:56.612Z","repository":{"id":290039376,"uuid":"961485410","full_name":"lab4studio/postcss-px-to-rem","owner":"lab4studio","description":"PostCSS plugin that automatically converts pixel (px) values to rem units in your CSS, allowing for scalable and responsive designs by basing measurements on the root font size.","archived":false,"fork":false,"pushed_at":"2025-05-17T09:10:23.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-01T12:39:45.028Z","etag":null,"topics":["postcss","postcss-plugin","px-to-em","px-to-rem"],"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/lab4studio.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-06T16:11:49.000Z","updated_at":"2025-05-17T10:09:35.000Z","dependencies_parsed_at":"2025-04-26T14:22:03.853Z","dependency_job_id":"2fdbe950-7b44-46c4-98f9-68ad653e80f7","html_url":"https://github.com/lab4studio/postcss-px-to-rem","commit_stats":null,"previous_names":["lab4studio/postcss-px-to-rem"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/lab4studio/postcss-px-to-rem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab4studio%2Fpostcss-px-to-rem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab4studio%2Fpostcss-px-to-rem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab4studio%2Fpostcss-px-to-rem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab4studio%2Fpostcss-px-to-rem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lab4studio","download_url":"https://codeload.github.com/lab4studio/postcss-px-to-rem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab4studio%2Fpostcss-px-to-rem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29903617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:46:13.553Z","status":"ssl_error","status_checked_at":"2026-02-27T14:46:10.522Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["postcss","postcss-plugin","px-to-em","px-to-rem"],"created_at":"2025-05-26T01:14:58.482Z","updated_at":"2026-02-27T16:05:56.600Z","avatar_url":"https://github.com/lab4studio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-px-to-rem\n\nA lightweight [PostCSS](https://github.com/postcss/postcss) plugin that converts pixel (`px`) units to relative `rem` or `em` units—improving scalability and accessibility in your CSS.\n\n```css\nh1 {\n    @apply text-[length:rem(32px_16px_3)];\n}\n```\n\n---\n\n## Installation\n\nInstall via npm:\n\n```bash\nnpm install -D @lab4studio/postcss-px-to-rem\n```\n\nThen add the plugin to your `postcss.config.cjs`:\n\n```js\nmodule.exports = {\n    plugins: {\n        '@lab4studio/postcss-px-to-rem': {\n            base: 16,\n            precision: 2,\n        },\n    },\n};\n```\n\n\u003e **Note:** Both `base` and `precision` options are optional. Defaults are `base: 16` and `precision: 4`.\n\n---\n\n## Why use it?\n\nWhile pixel units are convenient, they do not scale with user preferences—such as browser-level font size settings. This plugin allows you to retain the simplicity of `px` while outputting responsive and accessible `rem`/`em` values.\n\n---\n\n## Usage\n\nThis plugin parses and converts any `rem(...)` or `em(...)` functions inside your CSS values:\n\n```css\nh1 {\n    @apply text-[length:rem(32px_16px_3)];\n}\n\n\u003cdiv class=\"px-[em(13_12_2)]\"\u003e{{ markdown }}\u003c/div\u003e\n```\n\n\u003e **Note:** You can omit the unit if using the plugin in a compatible utility or expression context.\n\n---\n\n## Input → Output Example\n\n```css\n/* Input */\nh1 {\n    margin: 0 0 rem(16px);\n    font-size: rem(20px_10);\n    line-height: 1.2;\n    letter-spacing: em(1px);\n}\n```\n\n```css\n/* Output */\nh1 {\n    margin: 0 0 1rem;\n    font-size: 2rem;\n    line-height: 1.2;\n    letter-spacing: 0.0625em;\n}\n```\n\n---\n\n## Plugin Options\n\n```js\n{\n    base: 16,       // Base font size to calculate rem/em values\n    precision: 5    // Decimal precision for converted values\n}\n```\n\n- **`base`** (`number`) – The root font size used as a reference for conversion.\n- **`precision`** (`number`) – Number of decimal places to retain in the result.\n\n---\n\n## License\n\nMIT License – see [LICENSE-MIT](./LICENSE-MIT) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab4studio%2Fpostcss-px-to-rem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flab4studio%2Fpostcss-px-to-rem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab4studio%2Fpostcss-px-to-rem/lists"}