A PostCSS plugin to calculate trigonometric functions sin/cos/tan
npm install postcss-simple-trig
[PostCSS] plugin to calculate trigonometric functions: sin/cos/tan.
[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/Rplus/postcss-simple-trig.svg
[ci]: https://travis-ci.org/Rplus/postcss-simple-trig
``css`
/ Input /
.foo {
boo: sin(60deg);
padding: calc(cos(60deg) * 1em);
}
`css`
/ Output /
.foo {
boo: 0.86603;
padding: calc(0.5 * 1em);
}
`js`
postcss([ require('postcss-simple-trig') ]);
postcss([ require('postcss-simple-trig')({ precision: 2 }) ]);
See [PostCSS] docs for examples for your environment.
* default: 5
* allow: 0 ~ 20Used to determine how many digits after the decimal will be allowed.
ref: number.toFixed @ MDN
`css
/ Input /
.foo {
margin-left: sin(60deg);
}
``css
/ Output with { precision: 2 } /
.foo {
margin-left: 0.87;
}
``