Gathering detailed insights and metrics for @vusion/postcss-calc
Gathering detailed insights and metrics for @vusion/postcss-calc
Gathering detailed insights and metrics for @vusion/postcss-calc
Gathering detailed insights and metrics for @vusion/postcss-calc
npm install @vusion/postcss-calc
Typescript
Module System
Node Version
NPM Version
74.4
Supply Chain
98.2
Quality
80.6
Maintenance
50
Vulnerability
100
License
JavaScript (83.13%)
Yacc (16.87%)
Total Downloads
12,347
Last Day
1
Last Week
6
Last Month
89
Last Year
2,843
215 Stars
206 Commits
34 Forks
16 Watching
6 Branches
31 Contributors
Minified
Minified + Gzipped
Latest Version
7.0.3
Package Id
@vusion/postcss-calc@7.0.3
Unpacked Size
147.03 kB
Size
37.82 kB
File Count
10
NPM Version
6.13.2
Node Version
10.16.3
Cumulative downloads
Total Downloads
Last day
-90.9%
1
Compared to previous day
Last week
-72.7%
6
Compared to previous week
Last month
-17.6%
89
Compared to previous month
Last year
-53.9%
2,843
Compared to previous year
PostCSS Calc lets you reduce calc()
references whenever it's possible. This
can be particularly useful with the PostCSS Custom Properties plugin.
When multiple units are mixed together in the same expression, the calc()
statement is left as is, to fallback to the W3C calc() implementation.
1npm install postcss-calc
1// dependencies 2var fs = require("fs") 3var postcss = require("postcss") 4var calc = require("postcss-calc") 5 6// css to be processed 7var css = fs.readFileSync("input.css", "utf8") 8 9// process css 10var output = postcss() 11 .use(calc()) 12 .process(css) 13 .css
Example (with PostCSS Custom Properties enabled as well):
1// dependencies 2var fs = require("fs") 3var postcss = require("postcss") 4var customProperties = require("postcss-custom-properties") 5var calc = require("postcss-calc") 6 7// css to be processed 8var css = fs.readFileSync("input.css", "utf8") 9 10// process css 11var output = postcss() 12 .use(customProperties()) 13 .use(calc()) 14 .process(css) 15 .css
Using this input.css
:
1:root { 2 --main-font-size: 16px; 3} 4 5body { 6 font-size: var(--main-font-size); 7} 8 9h1 { 10 font-size: calc(var(--main-font-size) * 2); 11 height: calc(100px - 2em); 12 margin-bottom: calc( 13 var(--main-font-size) 14 * 1.5 15 ) 16}
you will get:
1body { 2 font-size: 16px 3} 4 5h1 { 6 font-size: 32px; 7 height: calc(100px - 2em); 8 margin-bottom: 24px 9}
Checkout tests for more examples.
precision
(default: 5
)Allow you to define the precision for decimal numbers.
1var out = postcss() 2 .use(calc({precision: 10})) 3 .process(css) 4 .css
preserve
(default: false
)Allow you to preserve calc() usage in output so browsers will handle decimal precision themselves.
1var out = postcss() 2 .use(calc({preserve: true})) 3 .process(css) 4 .css
warnWhenCannotResolve
(default: false
)Adds warnings when calc() are not reduced to a single value.
1var out = postcss() 2 .use(calc({warnWhenCannotResolve: true})) 3 .process(css) 4 .css
mediaQueries
(default: false
)Allows calc() usage as part of media query declarations.
1var out = postcss() 2 .use(calc({mediaQueries: true})) 3 .process(css) 4 .css
selectors
(default: false
)Allows calc() usage as part of selectors.
1var out = postcss() 2 .use(calc({selectors: true})) 3 .process(css) 4 .css
Example:
1div[data-size="calc(3*3)"] { 2 width: 100px; 3}
Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.
1git clone git@github.com:postcss/postcss-calc.git 2git checkout -b patch-1 3npm install 4npm test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
13 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
Found 3/25 approved changesets -- score normalized to 1
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
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