1
1
# reduce-css-calc
2
2
3
3
[ ![ Build Status] ( https://github.com/MoOx/reduce-css-calc/workflows/Build/badge.svg )] ( https://github.com/MoOx/reduce-css-calc/actions )
4
+
4
5
> Reduce CSS calc() function to the maximum.
5
6
6
- Particularly useful for packages like [ rework-calc] ( https://github.com/reworkcss/rework-calc ) or [ postcss-calc] ( https://github.com/postcss/postcss-calc ) .
7
+ Particularly useful for packages like
8
+ [ rework-calc] ( https://github.com/reworkcss/rework-calc ) or
9
+ [ postcss-calc] ( https://github.com/postcss/postcss-calc ) .
7
10
8
11
## Installation
9
12
@@ -16,42 +19,42 @@ npm install reduce-css-calc
16
19
### ` var reducedString = reduceCSSCalc(string, precision) `
17
20
18
21
``` javascript
19
- var reduceCSSCalc = require (' reduce-css-calc' )
22
+ var reduceCSSCalc = require (" reduce-css-calc" );
20
23
21
- reduceCSSCalc (" calc(1 + 1)" )
24
+ reduceCSSCalc (" calc(1 + 1)" );
22
25
// 2
23
26
24
- reduceCSSCalc (" calc((6 / 2) - (4 * 2) + 1)" )
27
+ reduceCSSCalc (" calc((6 / 2) - (4 * 2) + 1)" );
25
28
// -4
26
29
27
- reduceCSSCalc (" calc(1/3)" )
30
+ reduceCSSCalc (" calc(1/3)" );
28
31
// 0.33333
29
32
30
- reduceCSSCalc (" calc(1/3)" , 10 )
33
+ reduceCSSCalc (" calc(1/3)" , 10 );
31
34
// 0.3333333333
32
35
33
- reduceCSSCalc (" calc(3rem * 2 - 1rem)" )
36
+ reduceCSSCalc (" calc(3rem * 2 - 1rem)" );
34
37
// 5rem
35
38
36
- reduceCSSCalc (" calc(2 * 50%)" )
39
+ reduceCSSCalc (" calc(2 * 50%)" );
37
40
// 100%
38
41
39
- reduceCSSCalc (" calc(120% * 50%)" )
42
+ reduceCSSCalc (" calc(120% * 50%)" );
40
43
// 60%
41
44
42
- reduceCSSCalc (" a calc(1 + 1) b calc(1 - 1) c" )
45
+ reduceCSSCalc (" a calc(1 + 1) b calc(1 - 1) c" );
43
46
// a 2 b 0 c
44
47
45
- reduceCSSCalc (" calc(calc(calc(1rem * 0.75) * 1.5) - 1rem)" )
48
+ reduceCSSCalc (" calc(calc(calc(1rem * 0.75) * 1.5) - 1rem)" );
46
49
// 0.125rem
47
50
48
- reduceCSSCalc (" calc(calc(calc(1rem * 0.75) * 1.5) - 1px)" )
51
+ reduceCSSCalc (" calc(calc(calc(1rem * 0.75) * 1.5) - 1px)" );
49
52
// calc(1.125rem - 1px)
50
53
51
- reduceCSSCalc (" -moz-calc(100px / 2)" )
54
+ reduceCSSCalc (" -moz-calc(100px / 2)" );
52
55
// 50px
53
56
54
- reduceCSSCalc (" -moz-calc(50% - 2em)" )
57
+ reduceCSSCalc (" -moz-calc(50% - 2em)" );
55
58
// -moz-calc(50% - 2em)
56
59
```
57
60
@@ -61,7 +64,8 @@ See [unit tests](src/__tests__/index.js) for others examples.
61
64
62
65
## Contributing
63
66
64
- Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.
67
+ Work on a branch, install dev-dependencies, respect coding style & run tests
68
+ before submitting a bug fix or a feature.
65
69
66
70
``` console
67
71
git clone https://github.com/MoOx/reduce-css-calc.git
@@ -73,3 +77,9 @@ npm test
73
77
## [ Changelog] ( CHANGELOG.md )
74
78
75
79
## [ License] ( LICENSE-MIT )
80
+
81
+ ## Security contact information
82
+
83
+ To report a security vulnerability, please use the
84
+ [ Tidelift security contact] ( https://tidelift.com/security ) . Tidelift will
85
+ coordinate the fix and disclosure.
0 commit comments