{"id":13725344,"url":"https://github.com/polemius/postcss-clamp","last_synced_at":"2025-10-30T13:41:39.218Z","repository":{"id":43265091,"uuid":"260835311","full_name":"polemius/postcss-clamp","owner":"polemius","description":"PostCSS plugin to transform clamp() to combination of min/max","archived":false,"fork":false,"pushed_at":"2023-01-06T04:51:59.000Z","size":339,"stargazers_count":29,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T02:09:56.422Z","etag":null,"topics":["clamp","css","max","min","postcss"],"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/polemius.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-03T05:33:37.000Z","updated_at":"2022-11-11T17:01:23.000Z","dependencies_parsed_at":"2023-02-05T09:00:21.045Z","dependency_job_id":null,"html_url":"https://github.com/polemius/postcss-clamp","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Fpostcss-clamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Fpostcss-clamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Fpostcss-clamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Fpostcss-clamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polemius","download_url":"https://codeload.github.com/polemius/postcss-clamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248702169,"owners_count":21148114,"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":["clamp","css","max","min","postcss"],"created_at":"2024-08-03T01:02:20.145Z","updated_at":"2025-10-30T13:41:34.151Z","avatar_url":"https://github.com/polemius.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# PostCSS Clamp\n[![Build Status][ci-img]][ci] [![codecov.io][cov-img]][cov]\n\n[PostCSS] plugin to transform `clamp()` to combination of `min/max`.\n\n[PostCSS]:    https://github.com/postcss/postcss\n[ci-img]:     https://travis-ci.com/polemius/postcss-clamp.svg?branch=master\n[ci]:         https://travis-ci.com/polemius/postcss-clamp\n[cov-img]: https://codecov.io/github/polemius/postcss-clamp/coverage.svg?branch=master\n[cov]:        https://codecov.io/github/polemius/postcss-clamp?branch=master\n\nThis plugin transform this css:\n\n```css\n.foo {\n  width: clamp(10px, 4em, 80px);\n}\n```\n\ninto this:\n\n```css\n.foo {\n  width: max(10px, min(4em, 80px));\n}\n```\n\nOr with enabled options `precalculate`:\n\n```css\n.foo {\n  width: clamp(10em, 4px, 10px);\n}\n\n/* becomes */\n\n.foo {\n  width: max(10em, 14px);\n}\n```\n\n[!['Can I use' table](https://caniuse.bitsofco.de/image/css-math-functions.png)](https://caniuse.com/#feat=css-math-functions)\n\n## Instalation\n\n```bash\n$ npm install postcss postcss-clamp --save-dev\nor\n$ yarn add --dev postcss postcss-clamp\n```\n\n## Usage\n\nUse [PostCSS Clamp] as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssClamp = require('postcss-clamp');\n\npostcss([\n  postcssClamp(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n[PostCSS Clamp] runs in all Node environments, with special instructions for:\n\n| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |\n| --- | --- | --- | --- | --- | --- |\n\nSee [PostCSS] docs for examples for your environment.\n\n## Options\n\n### precalculate\n\nThe `precalculate` option determines whether values with the same unit\nshould be precalculated. By default, these are not precalculation.\n\n```js\npostcssColorHexAlpha({\n  precalculate: true\n});\n```\n\nThe second and third value has the same unit (`px`):\n\n```css\n.foo {\n  width: clamp(10em, 4px, 10px);\n}\n\n/* becomes */\n\n.foo {\n  width: max(10em, 14px);\n}\n```\n\nHere all values have the same unit:\n\n```css\n.foo {\n  width: clamp(10px, 4px, 10px);\n}\n\n/* becomes */\n\n.foo {\n  width: 24px;\n}\n```\n\n## LICENSE\n\nSee [LICENSE](LICENSE)\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Clamp]: https://github.com/polemius/postcss-clamp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolemius%2Fpostcss-clamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolemius%2Fpostcss-clamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolemius%2Fpostcss-clamp/lists"}