{"id":31967901,"url":"https://github.com/flonny/pxtovw","last_synced_at":"2025-10-14T18:43:39.868Z","repository":{"id":40757123,"uuid":"273950757","full_name":"flonny/pxToVw","owner":"flonny","description":"px to vw cli","archived":false,"fork":false,"pushed_at":"2023-01-06T11:13:33.000Z","size":1246,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-07T23:59:53.556Z","etag":null,"topics":["px","px-to-vw","px2vw","pxtovw","rem","vw"],"latest_commit_sha":null,"homepage":"","language":"CSS","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/flonny.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}},"created_at":"2020-06-21T17:17:29.000Z","updated_at":"2021-02-10T02:53:46.000Z","dependencies_parsed_at":"2023-02-05T23:01:33.356Z","dependency_job_id":null,"html_url":"https://github.com/flonny/pxToVw","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/flonny/pxToVw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flonny%2FpxToVw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flonny%2FpxToVw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flonny%2FpxToVw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flonny%2FpxToVw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flonny","download_url":"https://codeload.github.com/flonny/pxToVw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flonny%2FpxToVw/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020361,"owners_count":26086867,"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-10-14T02:00:06.444Z","response_time":60,"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":["px","px-to-vw","px2vw","pxtovw","rem","vw"],"created_at":"2025-10-14T18:43:38.805Z","updated_at":"2025-10-14T18:43:39.861Z","avatar_url":"https://github.com/flonny.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"## pxtovw\n\n\u003e - webpack loader [pxtovw-loader](https://www.npmjs.com/package/pxtovw-loader)\n\u003e - postcss plugin https://www.npmjs.com/package/pxtovw-postcss\n\n\u003epx convert vw \n\u003e将px 转成 vw\n```\n  -w, --viewportWidth [value]', 'set `vw` unit value (default: 750)'\n  -o, --output [path]\", \"the output file dirname\")\n  -p, --vwPrecision [value]', 'set vw value precision (default: 6)'\n  -u, --unitToConvert [value]\", \"set need to convert unit (default: 'px')\"\n  -m, --minPixelValue [value]\", \"mix convert px value (default: 1)\"\n```\n```\n  -w, --viewportWidth [value]', '设置视窗宽度 (默认: 750)'\n  -o, --output [path]\", \"设置输出路径\")\n  -p, --vwPrecision [value]', '设置转换为vw 的保留小数位数 (default: 6)'\n  -u, --unitToConvert [value]\", \"设置需要转换的单位 (default: 'px')\"\n  -m, --minPixelValue [value]\", \"最小转换数值 (default: 1)\"\n```\n## API\n```\nconst Pxtovw = require(\"../pxtovw\");\nconst config = {\n  viewportWidth: 750,\n  unitPrecision: 6,\n  unitToConvert: \"px\",\n  minPixelValue: 1,\n};\n\nconst pxtovwIns = new Pxtovw(config);\nconst vwCssText = pxtovwIns.converPxToVw('.....')\n```\n## use cli\n```\nnpm install pxtovw -g\npxtovw [filename].css -w 750 -o ./out -p 6 -u px -m 1\n```\n\n## Example\ninput test css file test.css\n```css\n.testcase {\n  height: 100px;\n  width: 100px;\n  border-radius: 20px;\n  padding: 10px 10px 10px!important;\n  margin: 10px;\n  font-size: 16px;\n  background-color: bisque;\n}\n```\n\ncli\n\n```\npxtovw test.css -o ./\n```\n\noutput css file test.vw.css\n\n```css\n.testcase {\n  height: 13.333333vw;\n  width: 13.333333vw;\n  border-radius: 2.666667vw;\n  padding: 1.333333vw 1.333333vw 1.333333vw!important;\n  margin: 1.333333vw;\n  font-size: 2.133333vw;\n  background-color: bisque;\n}\n```\n\nCalculation \n\n```javascript\n// height 100px\n//cover vw keep 6  precision\nconst vwHeight = (100/750)*100 //13.333333\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflonny%2Fpxtovw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflonny%2Fpxtovw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflonny%2Fpxtovw/lists"}