{"id":17497395,"url":"https://github.com/moox/reduce-css-calc","last_synced_at":"2025-04-04T21:09:29.127Z","repository":{"id":19357281,"uuid":"22596934","full_name":"MoOx/reduce-css-calc","owner":"MoOx","description":"Reduce CSS calc() function at the maximum","archived":false,"fork":false,"pushed_at":"2024-07-03T09:55:43.000Z","size":616,"stargazers_count":55,"open_issues_count":7,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T20:08:02.569Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MoOx.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"MoOx","ko_fi":"moox__","liberapay":"MoOx","custom":"https://www.paypal.com/paypalme/MoOx"}},"created_at":"2014-08-04T08:23:11.000Z","updated_at":"2024-07-03T09:55:46.000Z","dependencies_parsed_at":"2024-11-07T20:55:33.164Z","dependency_job_id":"5dc847e9-c45b-4097-96dc-5108e23f4041","html_url":"https://github.com/MoOx/reduce-css-calc","commit_stats":{"total_commits":107,"total_committers":15,"mean_commits":7.133333333333334,"dds":0.6355140186915889,"last_synced_commit":"a85dbfe3dabb17441b7cc59b1c3f8fee2069e10e"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freduce-css-calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freduce-css-calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freduce-css-calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Freduce-css-calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MoOx","download_url":"https://codeload.github.com/MoOx/reduce-css-calc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249530,"owners_count":20908212,"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-10-19T15:42:58.441Z","updated_at":"2025-04-04T21:09:29.094Z","avatar_url":"https://github.com/MoOx.png","language":"JavaScript","funding_links":["https://github.com/sponsors/MoOx","https://ko-fi.com/moox__","https://liberapay.com/MoOx","https://www.paypal.com/paypalme/MoOx","https://tidelift.com/security"],"categories":[],"sub_categories":[],"readme":"# reduce-css-calc\n\n[![Build Status](https://github.com/MoOx/reduce-css-calc/workflows/Build/badge.svg)](https://github.com/MoOx/reduce-css-calc/actions)\n\n\u003e Reduce CSS calc() function to the maximum.\n\nParticularly useful for packages like\n[rework-calc](https://github.com/reworkcss/rework-calc) or\n[postcss-calc](https://github.com/postcss/postcss-calc).\n\n## Installation\n\n```console\nnpm install reduce-css-calc\n```\n\n## Usage\n\n### `var reducedString = reduceCSSCalc(string, precision)`\n\n```javascript\nvar reduceCSSCalc = require(\"reduce-css-calc\");\n\nreduceCSSCalc(\"calc(1 + 1)\");\n// 2\n\nreduceCSSCalc(\"calc((6 / 2) - (4 * 2) + 1)\");\n// -4\n\nreduceCSSCalc(\"calc(1/3)\");\n// 0.33333\n\nreduceCSSCalc(\"calc(1/3)\", 10);\n// 0.3333333333\n\nreduceCSSCalc(\"calc(3rem * 2 - 1rem)\");\n// 5rem\n\nreduceCSSCalc(\"calc(2 * 50%)\");\n// 100%\n\nreduceCSSCalc(\"calc(120% * 50%)\");\n// 60%\n\nreduceCSSCalc(\"a calc(1 + 1) b calc(1 - 1) c\");\n// a 2 b 0 c\n\nreduceCSSCalc(\"calc(calc(calc(1rem * 0.75) * 1.5) - 1rem)\");\n// 0.125rem\n\nreduceCSSCalc(\"calc(calc(calc(1rem * 0.75) * 1.5) - 1px)\");\n// calc(1.125rem - 1px)\n\nreduceCSSCalc(\"-moz-calc(100px / 2)\");\n// 50px\n\nreduceCSSCalc(\"-moz-calc(50% - 2em)\");\n// -moz-calc(50% - 2em)\n```\n\nSee [unit tests](src/__tests__/index.js) for others examples.\n\n---\n\n## Contributing\n\nWork on a branch, install dev-dependencies, respect coding style \u0026 run tests\nbefore submitting a bug fix or a feature.\n\n```console\ngit clone https://github.com/MoOx/reduce-css-calc.git\ngit checkout -b patch-1\nnpm install\nnpm test\n```\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE-MIT)\n\n## Security contact information\n\nTo report a security vulnerability, please use the\n[Tidelift security contact](https://tidelift.com/security). Tidelift will\ncoordinate the fix and disclosure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoox%2Freduce-css-calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoox%2Freduce-css-calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoox%2Freduce-css-calc/lists"}