Gathering detailed insights and metrics for flex-gap-polyfill
Gathering detailed insights and metrics for flex-gap-polyfill
npm install flex-gap-polyfill
Typescript
Module System
Min. Node Version
Node Version
NPM Version
76.2
Supply Chain
100
Quality
77.6
Maintenance
100
Vulnerability
99.3
License
CSS (54.14%)
JavaScript (45.86%)
Total Downloads
277,088
Last Day
518
Last Week
1,955
Last Month
7,992
Last Year
102,295
149 Stars
370 Commits
6 Forks
1 Watching
32 Branches
6 Contributors
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
flex-gap-polyfill@5.0.0
Unpacked Size
127.14 kB
Size
28.58 kB
File Count
7
NPM Version
10.8.2
Node Version
22.5.1
Publised On
01 Aug 2024
Cumulative downloads
Total Downloads
Last day
2.8%
518
Compared to previous day
Last week
-7.2%
1,955
Compared to previous week
Last month
-14.2%
7,992
Compared to previous month
Last year
44.4%
102,295
Compared to previous year
1
1
This is a pure CSS polyfill using PostCSS to emulate flex gap using margins.
margin: auto
or background
.View the demo page for various test cases of the polyfill in action.
1.container { 2 display: flex; 3 gap: 40px; 4}
Becomes:
1/* Output simplified for purpose of example */ 2 3.container > * { 4 --fgp-parent-gap-row: 40px; 5 --fgp-parent-gap-column: 40px; 6 --fgp-margin-top: calc(var(--fgp-gap-row) + var(--orig-margin-top, 0px)); 7 --fgp-margin-left: calc( 8 var(--fgp-gap-column) + var(--orig-margin-left, 0px) 9 ); 10 margin-top: var(--fgp-margin-top); 11 margin-left: var(--fgp-margin-left); 12} 13 14.container { 15 --fgp-gap: var(--has-fgp, 40px); 16 --fgp-gap-row: 40px; 17 --fgp-gap-column: 40px; 18 --fgp-margin-top: calc( 19 var(--fgp-parent-gap-row, 0px) - var(--fgp-gap-row) + var(--orig-margin-top, 0px) 20 ); 21 --fgp-margin-left: calc( 22 var(--fgp-parent-gap-column, 0px) - var(--fgp-gap-column) + var(--orig-margin-left, 0px) 23 ); 24 display: flex; 25 gap: var(--fgp-gap, 0px); 26 margin-top: var(--fgp-margin-top, var(--orig-margin-top)); 27 margin-left: var(--fgp-margin-left, var(--orig-margin-left)); 28}
The polyfill emulates flex gap by adding margins to each child element and applying a negative margin to the container.
display: flex
and gap
are used in the same rule (see Options for ways to optimise)margin: auto
or background
)gap
, row-gap
and column-gap
Supports all current modern browsers, Edge, Firefox, Chrome, Safari, Opera (any browser that supports calc()
and var()
).
Add Flex Gap Polyfill to your project:
1npm install flex-gap-polyfill postcss --save-dev
Use Flex Gap Polyfill to process your CSS:
1const flexGapPolyfill = require("flex-gap-polyfill"); 2 3flexGapPolyfill.process(YOUR_CSS /*, processOptions, pluginOptions */);
Or use it as a PostCSS plugin:
1const postcss = require("postcss"); 2const flexGapPolyfill = require("flex-gap-polyfill"); 3 4postcss([flexGapPolyfill(/* pluginOptions */)]).process( 5 YOUR_CSS /*, processOptions */ 6);
only
Type: Array Default: undefined
When true
polyfill will only apply when display: flex | inline-flex
and gap
are used in the same rule. Provide an array of selectors to match additional rules. Can be strings
or regexes
. Inlcude /* apply fgp */
within a rule to manually apply the polyfill.
flexGapNotSupported
Type: String Default: false
Manually specify a selector to use when flex gap is not supported by detection via JavaScript, eg flexGapNotSupported: '.flex-gap-not-supported'
.
webComponents
Type: Boolean Default: false
When true
polyfill will also target slotted elements
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
84 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More