mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
![dependabot[bot]](/assets/img/avatar_default.png)
* Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript (#265) * Trying a new github workflow to install javascript packages * Bump tailwindcss from 1.9.2 to 1.9.4 in /build/javascript (#266) Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 1.9.2 to 1.9.4. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v1.9.2...v1.9.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript Bumps [preact](https://github.com/preactjs/preact) from 10.5.4 to 10.5.5. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.4...10.5.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Owncast <owncast@owncast.online> * Bump @justinribeiro/lite-youtube in /build/javascript Bumps [@justinribeiro/lite-youtube](https://github.com/justinribeiro/lite-youtube) from 0.9.0 to 0.9.1. - [Release notes](https://github.com/justinribeiro/lite-youtube/releases) - [Commits](https://github.com/justinribeiro/lite-youtube/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Owncast <owncast@owncast.online> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
77 lines
1.5 KiB
Markdown
Executable File
77 lines
1.5 KiB
Markdown
Executable File
# reduce-css-calc
|
|
|
|
[](https://travis-ci.org/MoOx/reduce-css-calc)
|
|
|
|
> Reduce CSS calc() function to the maximum.
|
|
|
|
Particularly useful for packages like [rework-calc](https://github.com/reworkcss/rework-calc) or [postcss-calc](https://github.com/postcss/postcss-calc).
|
|
|
|
## Installation
|
|
|
|
```console
|
|
npm install reduce-css-calc
|
|
```
|
|
|
|
## Usage
|
|
|
|
### `var reducedString = reduceCSSCalc(string, precision)`
|
|
|
|
```javascript
|
|
var reduceCSSCalc = require('reduce-css-calc')
|
|
|
|
reduceCSSCalc("calc(1 + 1)")
|
|
// 2
|
|
|
|
reduceCSSCalc("calc((6 / 2) - (4 * 2) + 1)")
|
|
// -4
|
|
|
|
reduceCSSCalc("calc(1/3)")
|
|
// 0.33333
|
|
|
|
reduceCSSCalc("calc(1/3)", 10)
|
|
// 0.3333333333
|
|
|
|
reduceCSSCalc("calc(3rem * 2 - 1rem)")
|
|
// 5rem
|
|
|
|
reduceCSSCalc("calc(2 * 50%)")
|
|
// 100%
|
|
|
|
reduceCSSCalc("calc(120% * 50%)")
|
|
// 60%
|
|
|
|
reduceCSSCalc("a calc(1 + 1) b calc(1 - 1) c")
|
|
// a 2 b 0 c
|
|
|
|
reduceCSSCalc("calc(calc(calc(1rem * 0.75) * 1.5) - 1rem)")
|
|
// 0.125rem
|
|
|
|
reduceCSSCalc("calc(calc(calc(1rem * 0.75) * 1.5) - 1px)")
|
|
// calc(1.125rem - 1px)
|
|
|
|
reduceCSSCalc("-moz-calc(100px / 2)")
|
|
// 50px
|
|
|
|
reduceCSSCalc("-moz-calc(50% - 2em)")
|
|
// -moz-calc(50% - 2em)
|
|
```
|
|
|
|
See [unit tests](src/__tests__/index.js) for others examples.
|
|
|
|
---
|
|
|
|
## Contributing
|
|
|
|
Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.
|
|
|
|
```console
|
|
git clone https://github.com/MoOx/reduce-css-calc.git
|
|
git checkout -b patch-1
|
|
npm install
|
|
npm test
|
|
```
|
|
|
|
## [Changelog](CHANGELOG.md)
|
|
|
|
## [License](LICENSE-MIT)
|