PostCSS Tools and Plugins
Installations
npm install @csstools/postcss-trigonometric-functions
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=18
Node Version
22.12.0
NPM Version
10.9.0
Score
97.8
Supply Chain
95.7
Quality
88.1
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Languages
CSS (43.37%)
JavaScript (30.22%)
TypeScript (22.76%)
HTML (3.06%)
Nunjucks (0.48%)
Shell (0.1%)
Developer
Download Statistics
Total Downloads
417,579,055
Last Day
710,192
Last Week
3,310,841
Last Month
14,857,072
Last Year
181,966,926
GitHub Statistics
931 Stars
4,164 Commits
73 Forks
11 Watching
3 Branches
131 Contributors
Bundle Size
79.51 kB
Minified
17.67 kB
Minified + Gzipped
Sponsor this package
Package Meta Information
Latest Version
4.0.6
Package Id
@csstools/postcss-trigonometric-functions@4.0.6
Unpacked Size
8.84 kB
Size
3.27 kB
File Count
7
NPM Version
10.9.0
Node Version
22.12.0
Publised On
27 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
417,579,055
Last day
-6.6%
710,192
Compared to previous day
Last week
-16.3%
3,310,841
Compared to previous week
Last month
8.1%
14,857,072
Compared to previous month
Last year
7.2%
181,966,926
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
PostCSS Trigonometric Functions
npm install @csstools/postcss-trigonometric-functions --save-dev
PostCSS Trigonometric Functions lets you use sin
, cos
, tan
, asin
, acos
, atan
and atan2
to be able to compute trigonometric relationships following the CSS Values 4 specification.
1.trigonometry { 2 line-height: sin(pi / 4); 3 line-height: cos(.125turn); 4 line-height: tan(50grad); 5 transform: rotate(asin(-1)); 6 transform: rotate(asin(sin(30deg + 1.0471967rad))); 7 transform: rotate(acos(-1)); 8 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 9 transform: rotate(atan(infinity)); 10 transform: rotate(atan(e - 2.7182818284590452354)); 11 transform: rotate(atan2(-infinity,-infinity)); 12 transform: rotate(atan2(-infinity,infinity)); 13 transform: rotate(atan2(-infinity,infinity)); 14 transform: rotate(atan2(90, 15)); 15} 16 17/* becomes */ 18 19.trigonometry { 20 line-height: 0.70711; 21 line-height: 0.70711; 22 line-height: 1; 23 transform: rotate(-90deg); 24 transform: rotate(89.99995deg); 25 transform: rotate(180deg); 26 transform: rotate(0deg); 27 transform: rotate(90deg); 28 transform: rotate(0deg); 29 transform: rotate(-135deg); 30 transform: rotate(-45deg); 31 transform: rotate(-45deg); 32 transform: rotate(80.53768deg); 33}
Usage
Add PostCSS Trigonometric Functions to your project:
1npm install postcss @csstools/postcss-trigonometric-functions --save-dev
Use it as a PostCSS plugin:
1const postcss = require('postcss'); 2const postcssTrigonometricFunctions = require('@csstools/postcss-trigonometric-functions'); 3 4postcss([ 5 postcssTrigonometricFunctions(/* pluginOptions */) 6]).process(YOUR_CSS /*, processOptions */);
⚠️ About custom properties
Given the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet.
Because of that, any usage that contains a var
is skipped.
Units
PostCSS Trigonometric Functions lets you use different special units that are within the spec and computed at run time to be able to calculate the result of the trigonometric function.
The following units are supported:
pi
: Computes toMath.PI
which is3.141592653589793
e
: Computes toMath.E
which is2.718281828459045
infinity
,-infinity
: Compute toInfinity
and-Infinity
respectively. Note that the usage is case insensitive soInFiNiTy
is a valid value.
Some calculations (such as sin(-infinity)
) might return NaN
as per the spec. Given that NaN
can't be replaced with a value that's useful to CSS it is left as is, as the result will be effectively ignored by the browser.
Options
preserve
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
1postcssTrigonometricFunctions({ preserve: true })
1.trigonometry { 2 line-height: sin(pi / 4); 3 line-height: cos(.125turn); 4 line-height: tan(50grad); 5 transform: rotate(asin(-1)); 6 transform: rotate(asin(sin(30deg + 1.0471967rad))); 7 transform: rotate(acos(-1)); 8 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 9 transform: rotate(atan(infinity)); 10 transform: rotate(atan(e - 2.7182818284590452354)); 11 transform: rotate(atan2(-infinity,-infinity)); 12 transform: rotate(atan2(-infinity,infinity)); 13 transform: rotate(atan2(-infinity,infinity)); 14 transform: rotate(atan2(90, 15)); 15} 16 17/* becomes */ 18 19.trigonometry { 20 line-height: 0.70711; 21 line-height: sin(pi / 4); 22 line-height: 0.70711; 23 line-height: cos(.125turn); 24 line-height: 1; 25 line-height: tan(50grad); 26 transform: rotate(-90deg); 27 transform: rotate(asin(-1)); 28 transform: rotate(89.99995deg); 29 transform: rotate(asin(sin(30deg + 1.0471967rad))); 30 transform: rotate(180deg); 31 transform: rotate(acos(-1)); 32 transform: rotate(0deg); 33 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 34 transform: rotate(90deg); 35 transform: rotate(atan(infinity)); 36 transform: rotate(0deg); 37 transform: rotate(atan(e - 2.7182818284590452354)); 38 transform: rotate(-135deg); 39 transform: rotate(atan2(-infinity,-infinity)); 40 transform: rotate(-45deg); 41 transform: rotate(atan2(-infinity,infinity)); 42 transform: rotate(-45deg); 43 transform: rotate(atan2(-infinity,infinity)); 44 transform: rotate(80.53768deg); 45 transform: rotate(atan2(90, 15)); 46}
No vulnerabilities found.
Reason
30 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT No Attribution: LICENSE.md:0
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 0 commits out of 7 are checked with a SAST tool
Reason
branch protection is not maximal on development and all release branches
Details
- Info: 'allow deletion' disabled on branch 'main'
- Info: 'force pushes' disabled on branch 'main'
- Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'
- Warn: could not determine whether codeowners review is allowed
- Warn: no status checks found to merge onto branch 'main'
- Warn: PRs are not required to make changes on branch 'main'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-preset-env.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/deploy-preset-env.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-preset-env.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/deploy-preset-env.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/labeler.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/labeler.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/lint.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/lint.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/csstools/postcss-plugins/test.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/test.yml:98
- Info: 0 out of 11 GitHub-owned GitHubAction dependencies pinned
- Info: 6 out of 7 npmCommand dependencies pinned
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/codeql.yml:1
- Warn: no topLevel permission defined: .github/workflows/deploy-preset-env.yml:1
- Warn: no topLevel permission defined: .github/workflows/labeler.yml:1
- Warn: no topLevel permission defined: .github/workflows/lint.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
5.9
/10
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