{"id":17967460,"url":"https://github.com/msidolphin/postcss-px-to-viewport-units","last_synced_at":"2026-04-28T11:03:47.083Z","repository":{"id":57328376,"uuid":"160946805","full_name":"msidolphin/postcss-px-to-viewport-units","owner":"msidolphin","description":"A CSS post-processor that converts px to viewport units (vw, vh, vmin, vmax).","archived":false,"fork":false,"pushed_at":"2018-12-11T01:49:59.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-29T18:38:01.928Z","etag":null,"topics":["postcss","postcss-plugin","vh","viewport-units","vmax","vmin","vw"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msidolphin.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}},"created_at":"2018-12-08T14:25:44.000Z","updated_at":"2023-04-07T11:35:33.000Z","dependencies_parsed_at":"2022-09-26T22:22:15.271Z","dependency_job_id":null,"html_url":"https://github.com/msidolphin/postcss-px-to-viewport-units","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/msidolphin/postcss-px-to-viewport-units","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msidolphin%2Fpostcss-px-to-viewport-units","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msidolphin%2Fpostcss-px-to-viewport-units/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msidolphin%2Fpostcss-px-to-viewport-units/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msidolphin%2Fpostcss-px-to-viewport-units/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msidolphin","download_url":"https://codeload.github.com/msidolphin/postcss-px-to-viewport-units/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msidolphin%2Fpostcss-px-to-viewport-units/sbom","scorecard":{"id":665698,"data":{"date":"2025-08-11","repo":{"name":"github.com/msidolphin/postcss-px-to-viewport-units","commit":"2b5e3f3d935b0aa28335e27739b3d7fe721fc2b5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T17:57:42.789Z","repository_id":57328376,"created_at":"2025-08-21T17:57:42.790Z","updated_at":"2025-08-21T17:57:42.790Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32377599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T09:24:15.638Z","status":"ssl_error","status_checked_at":"2026-04-28T09:24:15.071Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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","vh","viewport-units","vmax","vmin","vw"],"created_at":"2024-10-29T14:08:54.423Z","updated_at":"2026-04-28T11:03:47.052Z","avatar_url":"https://github.com/msidolphin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-px-to-viewport-units [![NPM version](https://badge.fury.io/js/postcss-px-to-viewport-units.svg)](http://badge.fury.io/js/postcss-px-to-viewport-units)\n\nForked by evrone/postcss-px-to-viewport \n\nA plugin for [PostCSS](https://github.com/ai/postcss) that generates viewport units (vw, vh, vmin, vmax) from pixel units.\n\n## Usage\n\nIf your project involves a fixed width, this script will help to convert pixels into viewport units.\n\n### Input/Output\n\n```css\n// input\n\n.class {\n  margin: -10px .5vh;\n  padding: 5vmin 9.5px 1px;\n  border: 3px solid black;\n  border-bottom-width: 1px;\n  font-size: 14px;\n  line-height: 20px;\n}\n\n.class2 {\n  border: 1px solid black;\n  margin-bottom: 1px;\n  font-size: 20px;\n  line-height: 30px;\n}\n\n@media (min-width: 750px) {\n  .class3 {\n    font-size: 16px;\n    line-height: 22px;\n  }\n}\n\n// output\n\n.class {\n  margin: -3.125vw .5vh;\n  padding: 5vmin 2.96875vw 1px;\n  border: 0.9375vw solid black;\n  border-bottom-width: 1px;\n  font-size: 4.375vw;\n  line-height: 6.25vw;\n}\n\n.class2 {\n  border: 1px solid black;\n  margin-bottom: 1px;\n  font-size: 6.25vw;\n  line-height: 9.375vw;\n}\n\n@media (min-width: 234.375vw) {\n  .class3 {\n    font-size: 5vw;\n    line-height: 6.875vw;\n  }\n}\n```\n\n### Example\n\n```js\n'use strict';\n\nvar fs = require('fs');\nvar postcss = require('postcss');\nvar pxToViewport = require('..');\nvar css = fs.readFileSync('main.css', 'utf8');\nvar options = {\n    replace: false\n};\nvar processedCss = postcss(pxToViewport(options)).process(css).css;\n\nfs.writeFile('main-viewport.css', processedCss, function (err) {\n  if (err) {\n    throw err;\n  }\n  console.log('File with viewport units written.');\n});\n```\n\n### Options\n\nDefault:\n```js\n{\n  unitToConvert: 'px',\n  viewportWidth: 320,\n  viewportHeight: 568, // not now used; TODO: need for different units and math for different properties\n  unitPrecision: 5,\n  viewportUnit: 'vw',\n  fontViewportUnit: 'vw',  // vmin is more suitable.\n  selectorBlackList: [],\n  minPixelValue: 1,\n  mediaQuery: false,\n  exclude: [] // ignore some files\n}\n```\n- `unitToConvert` (String) unit to convert, by default, it is px.\n- `viewportWidth` (Number) The width of the viewport.\n- `viewportHeight` (Number) The height of the viewport.\n- `unitPrecision` (Number) The decimal numbers to allow the REM units to grow to.\n- `viewportUnit` (String) Expected units.\n- `fontViewportUnit` (String) Expected units for font.\n- `selectorBlackList` (Array) The selectors to ignore and leave as px.\n    - If value is string, it checks to see if selector contains the string.\n        - `['body']` will match `.body-class`\n    - If value is regexp, it checks to see if the selector matches the regexp.\n        - `[/^body$/]` will match `body` but not `.body`\n- `minPixelValue` (Number) Set the minimum pixel value to replace.\n- `mediaQuery` (Boolean) Allow px to be converted in media queries.\n- `exclude` (Array or Regexp) Ignore some files like 'node_modules'\n    - If value is regexp, will ignore the matches files.\n    - If value is array, the elements of the array are regexp.\n\n### Use with gulp-postcss\n\n```js\nvar gulp = require('gulp');\nvar postcss = require('gulp-postcss');\nvar pxtoviewport = require('postcss-px-to-viewport-units');\n\ngulp.task('css', function () {\n\n    var processors = [\n        pxtoviewport({\n            viewportWidth: 320,\n            viewportUnit: 'vmin'\n        })\n    ];\n\n    return gulp.src(['build/css/**/*.css'])\n        .pipe(postcss(processors))\n        .pipe(gulp.dest('build/css'));\n});\n```\n### Use with webpack\n\n#### Install\n\n```bash\nnpm install postcss-px-to-viewport-units -D\n```\n\n#### webacpk config\n```js\nmodule.exports = {\n    module: {\n        rules: [\n            {\n                test: /\\.css$/,\n                use: [\"style-loader\", \"css-loader\", \"postcss-loader\"]\n            }\n        ]\n    }\n}\n```\n\n#### postcss config\nAnd create .postcssrc.js\n```js\nmodule.exports = {\n  \"plugins\": {\n    \"postcss-px-to-viewport-units\": {\n      viewportWidth: 750,\n      viewportHeight: 1334,\n      unitPrecision: 5,\n      viewportUnit: 'vw',\n      selectorBlackList: [],\n      fontViewportUnit: 'vw',\n      minPixelValue: 1,\n      mediaQuery: false,\n      exclude: [/node_modules/]\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsidolphin%2Fpostcss-px-to-viewport-units","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsidolphin%2Fpostcss-px-to-viewport-units","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsidolphin%2Fpostcss-px-to-viewport-units/lists"}