{"id":26601211,"url":"https://github.com/autopaideia/flextype","last_synced_at":"2026-04-15T14:36:26.375Z","repository":{"id":57238415,"uuid":"84257340","full_name":"autopaideia/flextype","owner":"autopaideia","description":"Scale text against its container width using CSS.","archived":false,"fork":false,"pushed_at":"2017-07-30T21:14:36.000Z","size":566,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T13:57:26.610Z","etag":null,"topics":["css","css-variables","font-scaling","font-size","javascript","responsive","scale"],"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/autopaideia.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":"2017-03-07T23:40:52.000Z","updated_at":"2019-08-22T09:08:52.000Z","dependencies_parsed_at":"2022-08-26T14:13:03.480Z","dependency_job_id":null,"html_url":"https://github.com/autopaideia/flextype","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/autopaideia/flextype","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autopaideia%2Fflextype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autopaideia%2Fflextype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autopaideia%2Fflextype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autopaideia%2Fflextype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autopaideia","download_url":"https://codeload.github.com/autopaideia/flextype/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autopaideia%2Fflextype/sbom","scorecard":{"id":217379,"data":{"date":"2025-08-11","repo":{"name":"github.com/autopaideia/flextype","commit":"6805476f6b2ed97631b5ac5114d00b840049b18d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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-17T01:54:21.193Z","repository_id":57238415,"created_at":"2025-08-17T01:54:21.194Z","updated_at":"2025-08-17T01:54:21.194Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31846227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T13:28:40.153Z","status":"ssl_error","status_checked_at":"2026-04-15T13:28:29.396Z","response_time":63,"last_error":"SSL_read: 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":["css","css-variables","font-scaling","font-size","javascript","responsive","scale"],"created_at":"2025-03-23T18:37:59.418Z","updated_at":"2026-04-15T14:36:26.355Z","avatar_url":"https://github.com/autopaideia.png","language":"JavaScript","readme":"# flextype\n\n[![Build Status](https://img.shields.io/travis/autopaideia/flextype.svg)](https://travis-ci.org/autopaideia/flextype) [![Build Status](https://saucelabs.com/buildstatus/autopaideia)](https://saucelabs.com/beta/builds/037d84ac42b4480ebdb2791f8b7927f3) [![Codecov](https://img.shields.io/codecov/c/github/autopaideia/flextype.svg)](https://codecov.io/github/autopaideia/flextype?branch=master) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nScale the font size of an element in proportion to its width... *in style*. 😎\n\n![Basic example](http://imgur.com/zoG8oUO.gif)\n\n[Full demo here](https://autopaideia.github.io/flextype/).\n\n## Features\n\n* Simple syntax for scaling at different amounts for different widths\n* Define your scaling ratios in CSS, allowing you to:\n  * easily override within media queries\n  * leverage whatever CSS-preprocessor variables you might be using for your site's layout and typography\n* No dependencies\n* Supports all modern browsers and IE9+\u003csup\u003e[[see caveat for IE/Edge]](#css-custom-props-caveat)\u003c/sup\u003e\n\n## Install\n\n### NPM\n\n```bash\nnpm install flextype --save\n```\n\n### Download\n\n* [Minified](https://unpkg.com/flextype/dist/flextype.min.js)\n* [Un-minified](https://unpkg.com/flextype/dist/flextype.js)\n\n### CDN\n\n```html\n\u003c!-- Minified: --\u003e\n\u003cscript src=\"https://unpkg.com/flextype/dist/flextype.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- Un-minified: --\u003e\n\u003cscript src=\"https://unpkg.com/flextype/dist/flextype.js\"\u003e\u003c/script\u003e\n```\n\n## Basic usage\n\n1. Add the class `js-flextype` to the element(s) you want to scale.\n\n    ```html\n    \u003cdiv class=\"MyElement js-flextype\"\u003eHello\u003c/div\u003e\n    ```\n\n2. In CSS set the percentage of the `.js-flextype` element's width you want the font size to be on the [CSS custom property](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) `--flextype`. For instance, if you want the font size to be `18px` when the element is `500px` wide and to scale linearly at that ratio, you would use the percentage `3.6%`.\n\n    ```css\n    .MyElement {\n      width: 30%;\n      float: left;\n      /* ... */\n      --flextype: 3.6%;\n    }\n    ```\n\n## Advanced usage\n\n### Alternative syntax\n\nThe ratio passed to flextype can also be expressed as a key-value pair written in JSON, where the key is an element width (in pixels) and the value is the desired corresponding font size (in pixels).\n\n```css\n.MyElement {\n  /* Use valid JSON wrapped in single quotes */\n  --flextype: '{ \"500\": 18 }';\n}\n```\n\n### Multiple ratios\n\nThe font size can be made to scale at different ratios for different width-ranges, flextype will adjust the font size depending on which rules the element's width currently falls between.\n\n```css\n.MyElement {\n  --flextype: '{ \"500\": 18, \"1000\": 22 }';\n}\n```\n\nGiven those rules we can expect that, for example, when `250px` wide `.MyElement` will have a font size of `9px` and when `750px` wide `.MyElement` will have a font size of `20px`.\n\n### Locking\n\nYou can lock the font size in for particular width-ranges by using `+` and `-` modifiers on the width keys.\n\n```css\n.MyElement {\n  --flextype: '{ \"250-\": 10, \"500+\": 18, \"1000\": \"22\" \"1500+\": 36 }';\n}\n\n```\n\nThe +/- modifiers will prevent the font size from scaling until the next/previous rule becomes active, respectively.\n\n## API\n\nFlextype also has a simple javascript interface, which for the most part you shouldn't have to interact with unless you want to do particularly custom stuff.\n\n* Manually force elements to scale outside of the window resize event\n\n    ```javascript\n    myElement.style.width = '300px';\n    flextype.flex();\n    ```\n* Use a custom selector instead of `.js-flextype`\n\n    ```javascript\n    const flexer = flextype(document.getElementsByClassName('💪'));\n    // Use flexer.flex() to manually scale should you need to\n    // Use flexer.destroy() to remove the resize listener and reset the font\n    ```\n\n* Execute code on an element whenever flextype finishes scaling it\n\n    ```javascript\n    myElement.addEventListener('flextype:changed', function() {\n      // Cycle the hue every 12px change in font size\n      const hue = ((parseFloat(this.style.fontSize) % 12) * 360) / 12;\n      this.style.color = `hsl(${hue}, 100%, 50%)`;\n    });\n    ```\n\n* Get the suggested font size of an element based on its CSS rules and width\n\n    ```javascript\n    flextype.getElSize(myElement);\n    ```\n\n* Set the font size based on CSS rules and width\n\n    ```javascript\n    flextype.setElSize(myElement);\n    ```\n\n* Parse a set of rules against a width programmatically\n\n    ```javascript\n    flextype.size({ '500-': 10, 1500: 20 }, 1000); // = 15\n    ```\n\n\n## Caveats\n\n\u003ca name=\"css-custom-props-caveat\"\u003e\u003c/a\u003e\n\n### 1. IE/Edge support\n\nCSS custom properties are supported in the latest versions of all the major browsers **[except IE and Edge](http://caniuse.com/#feat=css-variables)**. As a workaround flextype also accepts rules embedded in the `::before` pseudo element's content property.\n\n```css\n.MyElement::before {\n  content: '3.6%';\n  display: none;\n}\n```\n\nYou can use the [flextype PostCSS plugin](https://github.com/autopaideia/postcss-flextype) to convert your `--flextype` declarations into this format for you while Microsoft catches up.\n\n\u003ca name=\"initialization-caveat\"\u003e\u003c/a\u003e\n\n### 2. Trigger flextype manually after javascript manipulations\n\nThe font size of any `.js-flextype` elements will be scaled immediately when flextype.js is loaded and then again whenever the window is resized. However, if you insert a new `.js-flextype` element into the DOM after flextype has already initialized, or if you resize a flextype container outside of the normal window resize event, you'll need to manually trigger the resize with:\n\n```javascript\nflextype.flex();\n```\n\n### 3. Set a width\n\nFlextype bases the font size off the width of the `js-flextype` element. If the width of the `js-flextype` element is itself based off the font size of its content (as it is with inline elements, for example) it can't work.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautopaideia%2Fflextype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautopaideia%2Fflextype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautopaideia%2Fflextype/lists"}